Multilingual Plugin (DEPRECATED)
Simple cross platform plugin for handling language localization.
THIS PLUGIN IS DECPRECATED - NOT UNDER DEVELOPMENT AND NOT SUPPORTED
This plugin is no longer needed. More information here:
- Get and set current culture
- Get device culture
- Get culture list
- Get specific culture by name
|Windows 10 UWP||10+|
- Available on NuGet: http://www.nuget.org/packages/Plugin.Multilingual
- Install into your PCL project and Client projects.
- Add your Resx files
Add one resx file per each language you want to support. "It must follow a specific naming convention: use the same filename as the base resources file (eg. AppResources) followed by a period (.) and then the language code".
- Set the culture of your resource class file when initializing your application.
AppResources.Culture = CrossMultilingual.Current.DeviceCultureInfo;
If you are using Xamarin Forms it would be in your App.cs
Xamarin Forms Specifics
When installing the plugin it will create a TranslateExtension.txt file in folder Helpers, rename the extension for this file to TranslateExtension.cs.
In TranslateExtension.cs file in the constant ResourceId by default it will assume your resource file is added in the root of the project and the resx file is named as AppResources. If you added it to a folder or named the resx file differently you can change it there.
XAML sample usage:
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.
Call CrossMultilingual.Current from any project or PCL to gain access to APIs.
Gets and set the current culture. By default will be set to the device culture.
CrossMultilingual.Current.CurrentCultureInfo = new CultureInfo("en");
Note: After changing the current culture is important to update your resx class culture. As follows:
AppResources.Culture = CrossMultilingual.Current.CurrentCultureInfo;
Gets the device culture
Gets all cultures supported in .NET Framework (neutral & specific cultures)
Gets all cultures associated with a language (not specific to a country/region).
Gets a specific culture by language code.
In case you want to know more about localization: