The administration interface reads localized strings from .resx resource files that you register in the system. Register resource files to add admin UI translations, to localize the texts of your own customizations, or to change Xperience's default English strings. Each registration says which languages the file contains and which part of the system reads the strings.
Create and register .resx resource files using the conventional .NET approach (opens in a new tab).
Create a new .NET resource file in your custom assembly. The assembly must be discoverable. Otherwise, the system ignores its registrations. The web project of your application is discoverable automatically.
Register the resource file using the RegisterLocalizationResource assembly attribute. The attribute has the following parameters:
LocalizationTarget.Server.SystemContext.SYSTEM_CULTURE_NAME constant (en-us) for English. See Culture codes.using CMS.Base;
using CMS.Localization;
using MyProject.Resources;
// Registers the default English strings
[assembly: RegisterLocalizationResource(
typeof(LocalizationClient),
LocalizationTarget.Client,
SystemContext.SYSTEM_CULTURE_NAME)]
// Registers resources for additional languages
[assembly: RegisterLocalizationResource(
typeof(LocalizationClient),
LocalizationTarget.Client,
"cs-CZ")]
[assembly: RegisterLocalizationResource(
typeof(LocalizationClient),
LocalizationTarget.Client,
"de-DE")]
namespace MyProject.Resources;
// Class encapsulating the localization resource files
/* Corresponding .resx files: LocalizationClient.resx, LocalizationClient.cs-CZ.resx,
and LocalizationClient.de-DE.resx. */
public class LocalizationClient { }Resource file placement
Name each .resx file after its registration class and place it in the same folder as the class, for example, LocalizationClient.cs-CZ.resx next to LocalizationClient.cs. The build derives filenames from the class, and the system finds them without any additional configuration.
If you store the .resx files elsewhere, configure the LogicalName property in the project's .csproj file to map the files to the registration class. See the TrainingGuides.Admin project (opens in a new tab) for an example.
English resources for system and custom strings
English .resx files are not required for Xperience's default system strings. The system uses built-in English resources automatically. Register English resources only for your own resource keys, or when changing the default English text. See Default system culture.
The localization target determines which part of the system reads the strings of a resource file. Register each file for the target that displays its strings. To use the same strings in several targets, add a registration for each target.
Target | Use for | How the system uses the strings |
|---|---|---|
| Texts resolved in back-end code:
The default target. | Resolved on the server for each request and sent as part of API responses. |
| Texts in client-side admin code, retrieved using the i18n library in React components. | Sent to the browser when the admin UI loads. The strings don't resolve in |
| All texts of builder components in Page Builder, Form Builder, and Email Builder:
| Resolved on the server together with the If both targets contain the same key, the |