How to: Localize a Feature

By default, feature titles and descriptions use hard-coded string values. To localize the feature title and description, replace the strings with expressions that reference localized resources.

Localizing a Feature

To localize a feature

  1. Create separate feature resource files: one for the default language and one for each localized language that you want to support.

    To do this, right-click the Feature1 node in Solution Explorer and then click Add Feature Resource.

    Select Invariant Language as the culture for the default language feature resource file. Repeat this step for each localized language, selecting the languages of your choice for the localized feature resource files.

  2. Open each resource file in the Resource Editor and enter all of the string IDs and their values.

    For example, in the default feature resource file, enter a string ID of Title with a value of My Feature Title, and a second string ID of Description with a value of My Feature Description. For each localized resource file, use the same string IDs used in the default feature resource, but enter localized strings for the values.

  3. After all the resource values are entered, double-click the feature (for instance, Feature1.feature) to open it in the Feature Designer.

  4. To localize the Title and Description fields in the feature, enter values in their boxes using the following format:

    $Resources:String ID

    For example, enter $Resources:Title in the Feature Title box, and $Resources:Description in the Feature Description box.

    The string IDs must match those used in the resource files.

  5. Press F5 to build and run the application.

  6. In SharePoint, click Site Settings on the Site Actions menu, and then click the Manage Site Features link in the Site Actions section.

  7. In SharePoint, change the display language from the default.

    The localized feature title and description appear in the application. To display localized resources, the SharePoint server must have a language pack installed that matches the resource file's culture.

See Also

Tasks

How to: Add a Resource File

How to: Localize ASPX Markup

How to: Localize Code

Concepts

Localizing SharePoint Solutions