Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to make my custom solution for SharePoint 2010 multilingual, I have a Elements.xml file where all my ribbons controls are described but how can in reference to .resx from there and how can i be sure that correct language and culture will be choosed?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

All Sharepoint element.xml modules are localized the same way.

First of all, you need to deploy your resx files into SharePoint Resources mapped folder.

Resources mapped folder

After this, you can use following syntax to reference your localized resources:

$Resources: ResourceFileNameWithoutExtension, ResourceName

Code sample:

<CustomAction
  Id="MyTestCustomAction"
  Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.Read">
          <Tab
            Id="Ribbon.Read"
            Title="$Resources:TestResources,MyBrowseTabTitle;"
            Sequence="100"
            Command="ReadTab"
            Description=""
            CssClass="ms-browseTab"
            >
            <Scaling Id="Ribbon.Read.Scaling" />
            <Groups Id="Ribbon.Read.Groups" />
          </Tab>
        </CommandUIDefinition>
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>
share|improve this answer
    
I'm unable to get this working in 2013, see stackoverflow.com/questions/24746563/… –  iCe Jul 15 at 5:13
add comment

We use a resource helper that wraps SPUtility.GetLocalizedString in code and which can be called with a resource file name, an LCID and of course the resource key. For display purposes yoiu would call this with the current thread's UICulture LCID.

ASPX /ASCX files work differently, they reference resx files stored in the Web apps IIS folder (App_GlobalResources). These can be deployed to the SharePoint root (14-hive) in the config\resources folder. These get deployed to the IIS folder using %STSADM% -o copyappbincontent

Elements.xml can just reference the resources directly i.e. :

Name="$Resources:RESOURCEFILENAME,RESOURCEKEY;"

So, 3 options:

  1. From Code: SPUtility.GetLocalizedString
  2. Regular resource (i.e. elements.xml): Name="$Resources:RESOURCEFILENAME,RESOURCEKEY;"
  3. ASPX / ASCX : App_GlobalResources and %STSADM% -o copyappbincontent
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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