NuGet

Features

Ensure device culture match available cultures or set a default culture even when culture are neutral and device culture is not.

Get culture list

Get specific culture by name

Raise event when current culture change to update Resources Culture

Detect FlowDirection based on current culture :gift:

No markup extension needed to bind resource messages

Intellisense available for Resources :heart:

Platform Support

Platform

Version

Mono

5.4+

Xamarin.Forms

3.0+

Xamarin.iOS

iOS 10.14+

Xamarin.Android

API 14+

Windows 10 UWP

10+

Xamarin.Mac

+3.8

watchOS

All

tvOS

All

Setup

Install into your Net Standard project (clients are not needed).

If you want to use in Android, iOS with no Xamarin.Forms dependency use the Sources package.

Getting Started

Add your Resx files

Add one .resx file per language you want to support. As you can imagine it must follow a specific naming convention: use the same filename as the base resources file (eg. Messages) followed by a period (.) and then the language code.

In order to recognize the device language, you can use EnsureDeviceOrDefaultCulture, if device's language match available cultures, that culture will be set, otherwise, defaultCultureName will be used.

Xamarin Forms Specifics

This pacakage depends on new Xamarin.Forms 3.0 package with support to RTL content.

To use the resources in XAML, you need to import your resource class namespace and set any property value using the Static expression. You don't need any custom markup extension and it brings Intellisense support ;)

iOS Considerations

In the Info.plist file add the keys Localizations & Localization native development region to change the user interface OS elements. It will take the device language.

API Details

Call Localization.Current from any project or .net standard library project to gain access to APIs.

CurrentCultureInfo

Gets and set the current culture. By default will be set to the device culture.