1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-23 11:45:38 +01:00

added locale names dictionary

This commit is contained in:
Kyle Spearrin 2019-09-06 09:44:02 -04:00
parent b35a3339cb
commit 954aa1112a
2 changed files with 56 additions and 1 deletions

View File

@ -1,6 +1,7 @@
using Bit.App.Resources;
using Bit.Core.Abstractions;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using System.Resources;
@ -18,6 +19,7 @@ namespace Bit.App.Services
private readonly CultureInfo _defaultCulture = new CultureInfo("en-US");
private bool _inited;
private StringComparer _stringComparer;
private Dictionary<string, string> _localeNames;
public MobileI18nService(CultureInfo systemCulture)
{
@ -36,6 +38,57 @@ namespace Bit.App.Services
return _stringComparer;
}
}
public Dictionary<string, string> LocaleNames
{
get
{
if(_localeNames == null)
{
_localeNames = new Dictionary<string, string>
{
["af"] = "Afrikaans",
["bg"] = "български",
["ca"] = "català",
["cs"] = "čeština",
["da"] = "dansk",
["de"] = "Deutsch",
["el"] = "Ελληνικά",
["en"] = "English",
["en-GB"] = "English (British)",
["eo"] = "Esperanto",
["es"] = "español",
["et"] = "eesti",
["fa"] = "فارسی",
["fi"] = "suomi",
["fr"] = "français",
["he"] = "עברית",
["hi"] = "हिन्दी",
["hr"] = "hrvatski",
["hu"] = "magyar",
["id"] = "Bahasa Indonesia",
["it"] = "italiano",
["ja"] = "日本語",
["ko"] = "한국어",
["nb"] = "norsk (bokmål)",
["nl"] = "Nederlands",
["pl"] = "polski",
["pt-BR"] = "português do Brasil",
["pt-PT"] = "português",
["ro"] = "română",
["ru"] = "русский",
["sk"] = "slovenčina",
["sv"] = "svenska",
["th"] = "ไทย",
["tr"] = "Türkçe",
["uk"] = "українська",
["vi"] = "Tiếng Việt",
["zh-CN"] = "中文(中国大陆)",
["zh-TW"] = "中文(台灣)"
};
}
return _localeNames;
}
}
public void Init(CultureInfo culture = null)
{

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Bit.Core.Abstractions
@ -7,6 +8,7 @@ namespace Bit.Core.Abstractions
{
CultureInfo Culture { get; set; }
StringComparer StringComparer { get; }
Dictionary<string, string> LocaleNames { get; }
string T(string id, string p1 = null, string p2 = null, string p3 = null);
string Translate(string id, string p1 = null, string p2 = null, string p3 = null);
}