1

I have a feature in which several aspx pages are deployed to the pages library of a 2010 environment. These are fairly standard aspx pages in that they are attaching to the default maser page, have placeholder main and placeholder additionalpagehead content regions, and have the page content publishing control in them. They have dataview web parts and jQuery in them.

These pages now need to be localized in some other languages. I can add resource files to the solution and put them into place like:

<span class="form-headers"><b><asp:Literal runat="server" Text="<%$Resources:Locs,FullName%>"/></b></span>

This results in an error as such:

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Literal expressions like '<%$Resources:Locs,FullName%>' are not allowed. Use <asp:Literal runat="server" Text="<%$Resources:Locs,FullName%>" /> instead.

I've tried putting the resources files in the App_GlobalResources and every other place imaginable as mentioned in the various articles on localizing SharePoint features. I cannot get this to work properly.

So my question is how can you localize pages that get deployed to the Pages library or do I have to take some other approach to localize these files?

3

In the SharePoint projects I have worked on I have used a few different ways to localize page content. I think the simplest way for you will be with an EncodedLiteral:

<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,language_value%>' EncodeMethod='HtmlEncode' />

For the RESX files, in the SharePoint project I create a SharePoint mapped folder for the Resources folder in the 14/15 HIVE. This ensures they are in the right place and get loaded on the next IISRESET.

The other methods I have used that could work:

1) Create a custom ASP.NET control that gets the resources for you from a compiled form

2) Use JavaScript for localization (the way SharePoint-hosted apps get localized)

  • I'm pretty sure I tried this option as well with the same results. I'll try again. Do you have a reference or more information for point #2? – Eric Alexander May 19 '14 at 21:26
  • Check out msdn.microsoft.com/en-us/library/office/…. See the Localize remote JavaScript and the SharePoint chrome control section. – John Chapman May 19 '14 at 21:32
  • You basically create a JS file for each language with variables for each string. Then load the applicable JS based on the current locale. – John Chapman May 19 '14 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.