Localize the UI

Abstract

Overview of how to add a new language for localization.

The Sitecore Identity (SI) server uses ASP.NET Core services and middleware to localize to different languages and cultures. You store the messages that the SI server returns in the <application_root>\localization folder. The files are named in the common Sitecore localization file name format (languageName-cultureName.xml).

To add a new language for localization:

  1. Copy the localization file to the <application_root>\localization folder on the SI server.

  2. Restart the SI server application.

The SI server uses ASP.NET Core request providers to select language and culture for each request. For each request, the SI server uses the first provider in the following list that can determine what request culture is used:

  • StoredQueryStringCultureProvider

  • CookieRequestCultureProvider

  • AcceptLanguageHeaderRequestCultureProvider

If the UI culture is set in a query string, the StoredQueryStringCultureProvider provider resolves language and culture and stores it in a browser cookie to use with subsequent requests.

The following example sets the specific culture (language and region) to Spanish/Mexico:

    http://localhost:5000/?culture=es-MX

You can specify a default request language for when no provider can be resolved. This is controlled by the DefaultCulture setting in the Sitecore.identityServer.Host.xml file:

<Settings>
  <Sitecore>
    <IdentityServerHost>
      <DefaultCulture>en</DefaultCulture>
    </IdentityServerHost>
  </Sitecore>
</Settings>

The SI server uses culture fallback when it searches for localization resources. It starts at the requested culture. If it cannot find this, it goes to the parent culture of that culture. This normally, but not always, means that is removes the national signifier from the ISO code. For example, the dialect of Spanish spoken in Mexico is es-MX. The parent is es: Spanish that is not specific to any country.