diff options
author | gunchleoc <fios@foramnagaidhlig.net> | 2023-07-28 23:07:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-28 23:07:22 +0200 |
commit | b0134db6ff43a1cbcf2775043c69916a2713c6eb (patch) | |
tree | 33816b98fd84c04df3e381f4bcd56398a23416cc /app | |
parent | f96e4b30473cf31acfa450a71b65dff02ea33d19 (diff) |
Allow filtering for Chinese languages (#26066)
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/languages_helper.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/helpers/languages_helper.rb b/app/helpers/languages_helper.rb index 840a18d3e62..1f400b477a8 100644 --- a/app/helpers/languages_helper.rb +++ b/app/helpers/languages_helper.rb @@ -204,7 +204,17 @@ module LanguagesHelper zgh: ['Standard Moroccan Tamazight', 'ⵜⴰⵎⴰⵣⵉⵖⵜ'].freeze, }.freeze - SUPPORTED_LOCALES = {}.merge(ISO_639_1).merge(ISO_639_3).freeze + # e.g. For Chinese, which is not a language, + # but a language family in spite of sharing the main locale code + # We need to be able to filter these + ISO_639_1_REGIONAL = { + 'zh-CN': ['Chinese (China)', '简体中文'].freeze, + 'zh-HK': ['Chinese (Hong Kong)', '繁體中文(香港)'].freeze, + 'zh-TW': ['Chinese (Taiwan)', '繁體中文(臺灣)'].freeze, + 'zh-YUE': ['Cantonese', '廣東話'].freeze, + }.freeze + + SUPPORTED_LOCALES = {}.merge(ISO_639_1).merge(ISO_639_1_REGIONAL).merge(ISO_639_3).freeze # For ISO-639-1 and ISO-639-3 language codes, we have their official # names, but for some translations, we need the names of the @@ -217,9 +227,6 @@ module LanguagesHelper 'pt-BR': 'Português (Brasil)', 'pt-PT': 'Português (Portugal)', 'sr-Latn': 'Srpski (latinica)', - 'zh-CN': '简体中文', - 'zh-HK': '繁體中文(香港)', - 'zh-TW': '繁體中文(臺灣)', }.freeze def native_locale_name(locale) |