mirror of
https://github.com/torproject/torbrowser-launcher.git
synced 2024-11-26 19:10:31 +00:00
Fix language fallback for Chinese (Hong Kong)
* Add a way to manually override the language detection for some of the languages. * Add manual language overriding for zh-HK (to zh-TW).
This commit is contained in:
parent
fc2073de09
commit
e92e11e6d7
@ -73,11 +73,19 @@ class Common(object):
|
||||
|
||||
# figure out the language
|
||||
available_languages = ['ar', 'ca', 'da', 'de', 'en-US', 'es-ES', 'fa', 'fr', 'ga-IE', 'he', 'id', 'is', 'it', 'ja', 'ko', 'nb-NO', 'nl', 'pl', 'pt-BR', 'ru', 'sv-SE', 'tr', 'vi', 'zh-CN', 'zh-TW']
|
||||
|
||||
# a list of manually configured language fallback overriding
|
||||
language_overrides = {
|
||||
'zh-HK': 'zh-TW',
|
||||
}
|
||||
|
||||
default_locale = locale.getlocale()[0]
|
||||
if default_locale is None:
|
||||
self.language = 'en-US'
|
||||
else:
|
||||
self.language = default_locale.replace('_', '-')
|
||||
if self.language in language_overrides:
|
||||
self.language = language_overrides[self.language]
|
||||
if self.language not in available_languages:
|
||||
self.language = self.language.split('-')[0]
|
||||
if self.language not in available_languages:
|
||||
|
Loading…
Reference in New Issue
Block a user