Hot answers tagged

8

You can add fields programmatically using list.Fields.AddFieldAsXml, providing CAML field definition with resource tokens in it. Or you can wrap SetValueForUICulture in a nice helper method, and gain a capability to use it for any SPUserResource object. We're using this approach at work, and I would not say, that it is unclear or smth like this :) It's ok, ...


7

Yes, take a look into the file C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources\core.resx The format is : $Resources:name_of_resource_file, key_of_ressource A warning thought, this will concerns the resources you will find in all xml files, or in code. In aspx markup, the resources will be read from ...


5

RegisterSod doesn't fetch the script file. You must load it. Use LoadSodByKey, or use the plain tag to load it synchronously. I wrote a blog post about how to use javascript localizaton in SharePoint and scriptresx.ashx . Waldek Mastykarz shows how to use it with RegisterSod. But you have to know, that the script won't be downloaded before you explicitly ...


3

Have a look at SPUtility.GetLocalizedString()


3

For shared resource files in SharePoint (i.e. RESX files that must be shared amongst Features/Projects/Solutions), the best thing to do is to deploy them to the SharePoint Root's "Resources" folder (14/Resources). Then you'd reference them in one of two ways. In the RESX reference, you can specify the file name in the RESX reference like so (leaving off ...


3

I don't think you can reference it statically like that. Try this instead: <h2><asp:Literal runat="server" ID="Literal1" Text="<%$Resources:MyProject,Test_String_Heading%>"></asp:Literal></h2> EDIT: it's $Resources versus &Resources. Thanks for picking that up Bojan! UPDATE: As noted below the $Resources method of ...


3

The default language for a whole SharePoint system is based on the installation language of original SharePoint installation media and cannot be changed (without a re-install). With additional language packs, site collections can be created in a selection of languages, but once again, once the site collection has been created, the default language cannot be ...


3

You mean like this? using (SPSite site = new SPSite("http://localhost")) { using (SPWeb web = site.RootWeb) { if (web.IsMultilingual) { IEnumerable<CultureInfo> cultures = web.SupportedUICultures; foreach (CultureInfo culture in cultures) ...


3

SPUtility.GetLocalizedString("$Resources:YourKeyValue", "Comp.Dept.Proj.Farm\\GloablResources", 1033); plz refer this link http://geekswithblogs.net/venkatx5/archive/2010/12/14/how-to-create-multilingual-webpart-in-sharepoint-2010.aspx


2

You can add the layouts mapped folder to your project and keep javascript and css files there.You can then use ScriptLink class to register the js and CssRegistration class to register the css in the Page_Load method of the webpart. Following is the example: private const string script = "/_layouts/JQuery/JS/jquery.min.js"; ScriptLink.Register(Page, script ...


2

In SharePoint 2013 many (most?) of those strings are available either directly in JavaScript files (localized in folders such as Layouts\1033), or in culture-specific resource DLLs. Many of these DLLs are then loaded through the ScriptResx.ashx handler. For example, see these objects in JavaScript: SP.Res.* -> Loaded through ScriptResx.ashx Srch.Res.* -> ...


2

How do you mean? Most of the resources files can be found under C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\Resources, and hence can be altered without deploying a solution. But it is probably wise to update your resources also in your solution, to prevent it from overwriting your changes on the next deploy


2

There are two ways to use resource file. In .ascx file: <asp:Label ID="lbl1" runat="server" Text="<%$Resources:ResourcesFileName, ResourceFileItemKey %>" And in .cs file use SPUtility.GetLocalizedString() method For the second option your resource file should be present in sharepoint mapped resources folder. For more details visit this link ...


2

Localization of feature.xml differs from localizing something else. As by Microsoft's reference, you have to create a special Feature resource file (which will be stored along with the feature) in order to do that: How to: Localize a feature (MSDN) Based on my experience, if you deploy your resources into "Resources" mapped folder (in 14 hive), they will ...


2

I have the same issue in our SharePoint projects, but gave up on it because it appeared that SharePoint wasn't applying the resource fallback mechanism like I expected it to. Then I saw this post and decided to research this a little. I came across this article http://msdn.microsoft.com/en-us/library/ee696750.aspx and it says that a Default resource is: ...


2

SharePoint fallback is not like the ASP.NET fallback to the invariant culture; is first use the thread CurrentUICulture, then fallback to the SPWeb.Language: http://blogs.msdn.com/b/sharepointdev/archive/2011/07/01/localizing-the-sharepoint-user-interface-by-using-resource-files-sanjay-arora.aspx


2

Don't know if the OP still need this, but I hope it may be usefull to anyone experiencing the same issue. Turn out that Wictor Wilén has built a visual studio extension that manages the aforementioned setting automatically. You can find it on the Visual Studio Gallery under the name "SPResX Visual Studio 2012 Extension". It also offer the ability to ...


2

Perhaps the extra semicolon after resource key name "Devider" is causing the problem. It is not required.


2

Maybe you could make a copy of the ProjectResources.resx, then rename it as ProjectResources.en-US.resx.


2

If you are asking how to add them to your project, you can map the Layouts folder by right clicking on your project and selecting Add, SharePoint "Layouts" Mapped Folder. That should create a folder with the same name as your project. Anything that you add will be available globally in the /_layouts// folder. It is also possible to map to the SharePoint ...


2

You can't have resources files in webtemp*.xml files... Those are already localized with the folder that contains them. For example, check the file webtempsps.xml in the path C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\1033\XML. You will see that every string literals are in fact real string, and not in the format ...


2

SpContext.CurrentWeb.Language always returns languages that is used for site creation, if you would like to change languages on your site dynamically you should use `Thread.CurrentCulture.LCID'. If you would like to get this values in .aspx file, you should create module that deploys resources files to the GlobalResources folder. See this post how to do it. ...


1

Make sure your format to pick the name from the Resource file is: Name="$Resources:MyResources,TagsListInstanceTitle" MyResources – name of the resources file (as described below) TagsListInstanceTitle – the resource entry And the name of Resources file (for the entry above) for English should be: MyResources.en-US.resx And deployed to: ...


1

are you using embedded resources and accessing them in Sandbox solution likely? See more details: http://blog.sharepointbits.com/2011/03/localization-in-sharepoint-2010-sandbox.html


1

You need to escape the Resources tag, like this: <asp:literal runat="server" id="literal1" text="&lt;%$Resources:wss,view_selector_view;%&gt;" /> Ugly, but the only way unfortunately.


1

It's not well documented but SPUtility.GetLocalizedString don't support Language-neutral resources. See SharePoint SPUtility.GetLocalizedString() Behavior from Cliff Green's MSDN blog which describes SharePoints very different fallback behavior. I don't know if SharePoint reinvented or invented the resource management, but as you can see it's using its own ...


1

If there's nothing you did to "break" that, I suggest opening a Service Request through MS online portal or hard coding the DisplayName. Hard coding is a dirty workaround if you need to get it fixed quickly, and not generally a good idea. Or it just might start working tomorrow if you wait. Wonders of SharePoint Online.


1

Whatever resources are placed in SPHive/CONFIG/AdminResources will be placed in the Central Admin App_GlobalResources folder.


1

This is exactly what the SharePoint wsp package format is for. A quick Google found these 2 links. http://blog.mastykarz.nl/provisioning-appglobalresources-sharepoint-2010/ http://social.technet.microsoft.com/Forums/en-GB/sharepoint2010programming/thread/bdd711d9-cc57-495e-810a-d4fcc70d68ec- More on Google.


1

According to MSDN, the SPResource methods retrieve the localized strings from the microsoft.sharepoint.intl.dll assembly, not .resx files. [I don't have access to SharePoint assemblies at the moment to decompile them and confirm this information - if you do it, post a comment or edit this answer and write what you found.]



Only top voted, non community-wiki answers of a minimum length are eligible