Add support for preferred language on windows
This commit is contained in:
parent
191bb94078
commit
2704630eba
|
@ -4,28 +4,25 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Com.AlexanderZaytsev.RNI18n
|
namespace Com.AlexanderZaytsev.RNI18n {
|
||||||
{
|
|
||||||
class RNI18nModule : ReactContextNativeModuleBase
|
|
||||||
{
|
|
||||||
public RNI18nModule(ReactContext reactContext) : base(reactContext)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string Name
|
class RNI18nModule : ReactContextNativeModuleBase {
|
||||||
{
|
|
||||||
get
|
public RNI18nModule(ReactContext reactContext) : base(reactContext) {}
|
||||||
{
|
|
||||||
|
public override string Name {
|
||||||
|
get {
|
||||||
return "RNI18n";
|
return "RNI18n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IReadOnlyDictionary<string, object> Constants
|
public override IReadOnlyDictionary<string, object> Constants {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
Dictionary<string, object> constants = new Dictionary<string, object>();
|
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;
|
return constants;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue