i18n: Add list of language names
This commit is contained in:
parent
12c219ee6c
commit
9966c21c6b
@ -1,46 +1,47 @@
|
|||||||
# "bn_BD" => load_locale("bn_BD"), # Bengali (Bangladesh) [Incomplete]
|
# "bn_BD" => load_locale("bn_BD"), # Bengali (Bangladesh) [Incomplete]
|
||||||
# "eu" => load_locale("eu"), # Basque [Incomplete]
|
# "eu" => load_locale("eu"), # Basque [Incomplete]
|
||||||
# "si" => load_locale("si"), # Sinhala [Incomplete]
|
|
||||||
# "sk" => load_locale("sk"), # Slovak [Incomplete]
|
# "sk" => load_locale("sk"), # Slovak [Incomplete]
|
||||||
# "sr" => load_locale("sr"), # Serbian [Incomplete]
|
# "sr" => load_locale("sr"), # Serbian [Incomplete]
|
||||||
# "sr_Cyrl" => load_locale("sr_Cyrl"), # Serbian (cyrillic) [Incomplete]
|
# "sr_Cyrl" => load_locale("sr_Cyrl"), # Serbian (cyrillic) [Incomplete]
|
||||||
LOCALES = {
|
LOCALES_LIST = {
|
||||||
"ar" => load_locale("ar"), # Arabic
|
"ar" => "العربية", # Arabic
|
||||||
"cs" => load_locale("cs"), # Czech
|
"cs" => "Čeština", # Czech
|
||||||
"da" => load_locale("da"), # Danish
|
"da" => "Dansk", # Danish
|
||||||
"de" => load_locale("de"), # German
|
"de" => "Deutsch", # German
|
||||||
"el" => load_locale("el"), # Greek
|
"el" => "Ελληνικά", # Greek
|
||||||
"en-US" => load_locale("en-US"), # English (US)
|
"en-US" => "English", # English
|
||||||
"eo" => load_locale("eo"), # Esperanto
|
"eo" => "Esperanto", # Esperanto
|
||||||
"es" => load_locale("es"), # Spanish
|
"es" => "Español", # Spanish
|
||||||
"fa" => load_locale("fa"), # Persian
|
"fa" => "فارسی", # Persian
|
||||||
"fi" => load_locale("fi"), # Finnish
|
"fi" => "Suomi", # Finnish
|
||||||
"fr" => load_locale("fr"), # French
|
"fr" => "Français", # French
|
||||||
"he" => load_locale("he"), # Hebrew
|
"he" => "עברית", # Hebrew
|
||||||
"hr" => load_locale("hr"), # Croatian
|
"hr" => "Hrvatski", # Croatian
|
||||||
"hu-HU" => load_locale("hu-HU"), # Hungarian
|
"hu-HU" => "Magyar Nyelv", # Hungarian
|
||||||
"id" => load_locale("id"), # Indonesian
|
"id" => "Bahasa Indonesia", # Indonesian
|
||||||
"is" => load_locale("is"), # Icelandic
|
"is" => "Íslenska", # Icelandic
|
||||||
"it" => load_locale("it"), # Italian
|
"it" => "Italiano", # Italian
|
||||||
"ja" => load_locale("ja"), # Japanese
|
"ja" => "日本語", # Japanese
|
||||||
"ko" => load_locale("ko"), # Korean
|
"ko" => "한국어", # Korean
|
||||||
"lt" => load_locale("lt"), # Lithuanian
|
"lt" => "Lietuvių", # Lithuanian
|
||||||
"nb-NO" => load_locale("nb-NO"), # Norwegian Bokmål
|
"nb-NO" => "Norsk bokmål", # Norwegian Bokmål
|
||||||
"nl" => load_locale("nl"), # Dutch
|
"nl" => "Nederlands", # Dutch
|
||||||
"pl" => load_locale("pl"), # Polish
|
"pl" => "Polski", # Polish
|
||||||
"pt" => load_locale("pt"), # Portuguese
|
"pt" => "Português", # Portuguese
|
||||||
"pt-BR" => load_locale("pt-BR"), # Portuguese (Brazil)
|
"pt-BR" => "Português Brasileiro", # Portuguese (Brazil)
|
||||||
"pt-PT" => load_locale("pt-PT"), # Portuguese (Portugal)
|
"pt-PT" => "Português de Portugal", # Portuguese (Portugal)
|
||||||
"ro" => load_locale("ro"), # Romanian
|
"ro" => "Română", # Romanian
|
||||||
"ru" => load_locale("ru"), # Russian
|
"ru" => "русский", # Russian
|
||||||
"sv-SE" => load_locale("sv-SE"), # Swedish
|
"sv-SE" => "Svenska", # Swedish
|
||||||
"tr" => load_locale("tr"), # Turkish
|
"tr" => "Türkçe", # Turkish
|
||||||
"uk" => load_locale("uk"), # Ukrainian
|
"uk" => "Українська", # Ukrainian
|
||||||
"vi" => load_locale("vi"), # Vietnamese
|
"vi" => "Tiếng Việt", # Vietnamese
|
||||||
"zh-CN" => load_locale("zh-CN"), # Chinese (Simplified)
|
"zh-CN" => "汉语", # Chinese (Simplified)
|
||||||
"zh-TW" => load_locale("zh-TW"), # Chinese (Traditional)
|
"zh-TW" => "漢語", # Chinese (Traditional)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOCALES = load_all_locales()
|
||||||
|
|
||||||
CONTENT_REGIONS = {
|
CONTENT_REGIONS = {
|
||||||
"AE", "AR", "AT", "AU", "AZ", "BA", "BD", "BE", "BG", "BH", "BO", "BR", "BY",
|
"AE", "AR", "AT", "AU", "AZ", "BA", "BD", "BE", "BG", "BH", "BO", "BR", "BY",
|
||||||
"CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "DZ", "EC", "EE",
|
"CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "DZ", "EC", "EE",
|
||||||
@ -53,8 +54,14 @@ CONTENT_REGIONS = {
|
|||||||
"YE", "ZA", "ZW",
|
"YE", "ZA", "ZW",
|
||||||
}
|
}
|
||||||
|
|
||||||
def load_locale(name)
|
def load_all_locales
|
||||||
return JSON.parse(File.read("locales/#{name}.json")).as_h
|
locales = {} of String => Hash(String, JSON::Any)
|
||||||
|
|
||||||
|
LOCALES_LIST.each_key do |name|
|
||||||
|
locales[name] = JSON.parse(File.read("locales/#{name}.json")).as_h
|
||||||
|
end
|
||||||
|
|
||||||
|
return locales
|
||||||
end
|
end
|
||||||
|
|
||||||
def translate(locale : Hash(String, JSON::Any) | Nil, translation : String, text : String | Nil = nil)
|
def translate(locale : Hash(String, JSON::Any) | Nil, translation : String, text : String | Nil = nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user