win10apps-212262-localization.md
The following DevExpress Win10 App controls display built-in strings that can be localized into various languages.
You can localize control strings in code and by defining them in resources.
Use the DevExpress.Core.Localization.Localizer class to localize a control’s built-in text in code. This class provides the static AddString method that allows you to add a control’s localized string for a specific language.
public sealed partial class App : Application {
static App() {
Localizer.AddString("de", PdfViewerStringID.OpenButtonText, "Öffnen");
}
}
The first parameter of the AddString method specifies the name of the target language. A list of supported language names can be found in MSDN at:Choosing your languages.
The second parameter is the identifier of a string to be translated. The following enumerators contain available string identifiers.
The third parameter of the AddString method specifies the translated string.
Tip
There is an AddString method overload that does not require the target language name to be specified. A translated string provided with this method will be used in all cases that require the default string.
Localizer.AddString(PdfViewerStringID.OpenButtonText, "Öffnen");
The Localizer.AddString method needs to be called before a localizable control is created. The best place to add localized strings is a static constructor of your Application or Page class.
You can define localized strings in resources as follows.
Add a folder to your project and give it a name matching the target language name.
Add a resource file to this project with the Add->New Item… command, which is available from the folder’s context menu.
Add localizable strings to this resource file.
Enable the use of this resource file with the static DevExpress.Core.Localization.Localizer.EnableResourceStrings property.
The DevExpress localization mechanism searches for translated strings in the following order.