Add support for preferred language on windows

This commit is contained in:
Mathieu Acthernoene 2017-04-06 00:36:49 +02:00
parent 191bb94078
commit 2704630eba
1 changed files with 13 additions and 16 deletions

View File

@ -4,28 +4,25 @@ using System;
using System.Collections.Generic;
using System.Globalization;
namespace Com.AlexanderZaytsev.RNI18n
{
class RNI18nModule : ReactContextNativeModuleBase
{
public RNI18nModule(ReactContext reactContext) : base(reactContext)
{
}
namespace Com.AlexanderZaytsev.RNI18n {
public override string Name
{
get
{
class RNI18nModule : ReactContextNativeModuleBase {
public RNI18nModule(ReactContext reactContext) : base(reactContext) {}
public override string Name {
get {
return "RNI18n";
}
}
public override IReadOnlyDictionary<string, object> Constants
{
get
{
public override IReadOnlyDictionary<string, object> Constants {
get {
Dictionary<string, object> constants = new Dictionary<string, object>();
constants["locale"] = System.Globalization.CultureInfo.CurrentCulture.Name;
constants["language"] = Windows.System.UserProfile.GlobalizationPreferences.Languages[0];
constants["languages"] = Windows.System.UserProfile.GlobalizationPreferences.Languages;
return constants;
}
}