Tag Info

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 ...


4

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

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

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

Have a look at SPUtility.GetLocalizedString()


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 ...


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

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 ...


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

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

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


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

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

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

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

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

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


1

It can also be done in code behind OnInit function e.g., protected override void OnInit(EventArgs e) { base.OnInit(e); InitializeControl(); CultureInfo ci = SPContext.Current.Web.Locale; string url = string.Format("/_layouts/15/ScriptResx.ashx?name=MyResourceFile&culture={0}&rev={1}", ci.ToString(), ...


1

try by adding the Threading namespace to the top of the page: <%@ Import NameSpace="System.Threading" %>


1

So, from the link mentioned in my comment above: <%= SPUtility.GetLocalizedString("$Resources:MyTitle", "MeResourceFile", Thread.CurrentThread.CurrentUICulture.LCID); %> http://social.msdn.microsoft.com/Forums/sharepoint/en-US/6d036f6a-d1e5-41ce-b5dc-f8a0060d0f5d/access-resource-file-from-page-layout


1

Here's a guide on how to make your resource files both localized as well as globalized


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

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

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

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

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

You can use following: $Resources:FileName,Key; File name should be without extension. But do not foget to setup feature dependency if your xml is located in another feature as resources files.



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