Skip to content

Localization

Neil McAlister edited this page Feb 7, 2017 · 1 revision

Localization

Xalami contains some very basic in service of localization.

Xalami uses .resx files to store localization resources by default. The default .resx file is named Strings.resx and can be found in the PCL under AppResources. It also defines a simple DependencyService for obtaining platform-specific locales and turning them into a .NET-friendly locale. In addition, the Windows platforms contain a workaround for the WinRT PCL resource lookup issue.

Using Localized Resources

Easy! Put your resources to be localized in a .resx file under AppResources named like .<2-letter-locale>.resx. For example, you might name your Spanish strings Strings.es.resx. The code-behind file will automatically be generated, and the strings can then be accessed simply by doing the following:

Label.Text = AppResources.Strings.YourStringKeyHere;

You can also refer to localized resources in XAML markup using the LocalizeExtension, documented under XAML Markup Extensions.

Note: When setting up your various resource files, make sure that only your default locale file is using the custom tool "PublicResXFileCodeGenerator". You can right-click your resource file and go to Properties to verify this.

Clone this wiki locally