mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add language names
This commit is contained in:
parent
dc102da621
commit
c8be108bca
@ -6,48 +6,61 @@ namespace Bloxstrap
|
|||||||
{
|
{
|
||||||
internal static class Locale
|
internal static class Locale
|
||||||
{
|
{
|
||||||
// TODO: put translated names
|
|
||||||
public static readonly Dictionary<string, string> SupportedLocales = new()
|
public static readonly Dictionary<string, string> SupportedLocales = new()
|
||||||
{
|
{
|
||||||
{ "nil", Strings.Enums_Theme_Default }, // /shrug
|
{ "nil", Strings.Enums_Theme_Default }, // /shrug
|
||||||
{ "en", "English" },
|
{ "en", "English" },
|
||||||
{ "en-US", "English (United States)" },
|
{ "en-US", "English (United States)" },
|
||||||
{ "ar", "Arabic" },
|
{ "ar", "العربية" },
|
||||||
{ "bn", "Bengali" },
|
{ "bn", "বাংলা" },
|
||||||
{ "bs", "Bosnian" },
|
{ "bs", "Босански" },
|
||||||
{ "bg", "Bulgarian" },
|
{ "bg", "Български" },
|
||||||
{ "zh-CN", "Chinese (Simplified)" },
|
{ "zh-CN", "中文(简体)" },
|
||||||
{ "zh-TW", "Chinese (Traditional)" },
|
{ "zh-TW", "中文(繁體)" },
|
||||||
{ "cs", "Czech" },
|
{ "cs", "Čeština" },
|
||||||
{ "dk", "Danish" },
|
{ "dk", "Dansk" },
|
||||||
{ "nl", "Dutch" },
|
{ "nl", "Nederlands" },
|
||||||
{ "fl", "Filipino" },
|
{ "fl", "Filipino" },
|
||||||
{ "fi", "Finnish" },
|
{ "fi", "Suomi" },
|
||||||
{ "fr", "French" },
|
{ "fr", "Français" },
|
||||||
{ "de", "German" },
|
{ "de", "Deutsch" },
|
||||||
{ "he", "Hebrew" },
|
{ "he", "עברית" },
|
||||||
{ "hi", "Hindi" },
|
{ "hi", "हिन्दी" },
|
||||||
{ "hu", "Hungarian" },
|
{ "hu", "Magyar" },
|
||||||
{ "id", "Indonesian" },
|
{ "id", "Bahasa Indonesia" },
|
||||||
{ "it", "Italian" },
|
{ "it", "Italiano" },
|
||||||
{ "ja", "Japanese" },
|
{ "ja", "日本語" },
|
||||||
{ "ko", "Korean" },
|
{ "ko", "한국어" },
|
||||||
{ "lt", "Lithuanian" },
|
{ "lt", "Lietuvių" },
|
||||||
{ "no", "Norwegian" },
|
{ "no", "Bokmål" },
|
||||||
{ "pl", "Polish" },
|
{ "pl", "Polski" },
|
||||||
{ "pt-BR", "Portuguese" },
|
{ "pt-BR", "Português (Brasil)" },
|
||||||
{ "ro", "Romanian" },
|
{ "ro", "Română" },
|
||||||
{ "ru", "Russian" },
|
{ "ru", "Русский" },
|
||||||
{ "es", "Spanish" },
|
{ "es", "Español" },
|
||||||
{ "sv-SE", "Swedish" },
|
{ "sv-SE", "Svenska" },
|
||||||
{ "th", "Thai" },
|
{ "th", "ภาษาไทย" },
|
||||||
{ "tr", "Turkish" },
|
{ "tr", "Türkçe" },
|
||||||
{ "uk", "Ukrainian" },
|
{ "uk", "Yкраїньска" },
|
||||||
{ "vi", "Vietnamese" }
|
{ "vi", "Tiếng Việt" }
|
||||||
};
|
};
|
||||||
|
|
||||||
public static string GetIdentifierFromName(string language) => Locale.SupportedLocales.Where(x => x.Value == language).First().Key;
|
public static string GetIdentifierFromName(string language) => Locale.SupportedLocales.Where(x => x.Value == language).First().Key;
|
||||||
|
|
||||||
|
public static List<string> GetLanguages()
|
||||||
|
{
|
||||||
|
var languages = new List<string>()
|
||||||
|
{
|
||||||
|
Strings.Enums_Theme_Default,
|
||||||
|
"English",
|
||||||
|
"English (United States)"
|
||||||
|
};
|
||||||
|
|
||||||
|
languages.AddRange(SupportedLocales.Values.Where(x => !languages.Contains(x)).OrderBy(x => x));
|
||||||
|
|
||||||
|
return languages;
|
||||||
|
}
|
||||||
|
|
||||||
public static void Set()
|
public static void Set()
|
||||||
{
|
{
|
||||||
string identifier = App.Settings.Prop.Locale;
|
string identifier = App.Settings.Prop.Locale;
|
||||||
|
@ -15,7 +15,7 @@ namespace Bloxstrap.UI.ViewModels.Dialogs
|
|||||||
|
|
||||||
public ICommand SetLocaleCommand => new RelayCommand(SetLocale);
|
public ICommand SetLocaleCommand => new RelayCommand(SetLocale);
|
||||||
|
|
||||||
public static List<string> Languages => Locale.SupportedLocales.Values.ToList();
|
public static List<string> Languages => Locale.GetLanguages();
|
||||||
|
|
||||||
public string SelectedLanguage { get; set; } = Locale.SupportedLocales[App.Settings.Prop.Locale];
|
public string SelectedLanguage { get; set; } = Locale.SupportedLocales[App.Settings.Prop.Locale];
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ namespace Bloxstrap.UI.ViewModels.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<string> Languages => Locale.SupportedLocales.Values.ToList();
|
public static List<string> Languages => Locale.GetLanguages();
|
||||||
|
|
||||||
public string SelectedLanguage
|
public string SelectedLanguage
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user