locale: don't translate names of languages

note this is just a conceptual change, in practice it is a no-op:
i18n.py global scope is executed much earlier than the language gets set.
see https://github.com/spesmilo/electrum/blob/61a6ab1d95e6faccce45ed008426283430fa99d4/run_electrum#L422
This commit is contained in:
SomberNight
2026-02-14 10:03:03 +00:00
parent 61a6ab1d95
commit 1fc8804791
+39 -35
View File
@@ -125,42 +125,46 @@ def set_language(x: Optional[str]) -> None:
_language = gettext.translation('electrum', LOCALE_DIR, fallback=True, languages=[x])
# note: The values (human-visible lang names) should be either in English or in their own lang,
# but NOT translated to the currently selected lang.
# e.g. "fr_FR" we could show as either "French" or "Français", or even as "French - Français",
# but it is evil to show it as "Französisch". How am I supposed to switch back to English from Korean??? :)
languages = {
'': _('Default'),
'ar_SA': _('Arabic'),
'bg_BG': _('Bulgarian'),
'cs_CZ': _('Czech'),
'da_DK': _('Danish'),
'de_DE': _('German'),
'el_GR': _('Greek'),
'eo_UY': _('Esperanto'),
'en_UK': _('English'), # selecting this guarantees seeing the untranslated source strings
'es_ES': _('Spanish'),
'fa_IR': _('Persian'),
'fr_FR': _('French'),
'hu_HU': _('Hungarian'),
'hy_AM': _('Armenian'),
'id_ID': _('Indonesian'),
'it_IT': _('Italian'),
'ja_JP': _('Japanese'),
'ky_KG': _('Kyrgyz'),
'lv_LV': _('Latvian'),
'nb_NO': _('Norwegian Bokmal'),
'nl_NL': _('Dutch'),
'pl_PL': _('Polish'),
'pt_BR': _('Portuguese (Brazil)'),
'pt_PT': _('Portuguese'),
'ro_RO': _('Romanian'),
'ru_RU': _('Russian'),
'sk_SK': _('Slovak'),
'sl_SI': _('Slovenian'),
'sv_SE': _('Swedish'),
'ta_IN': _('Tamil'),
'th_TH': _('Thai'),
'tr_TR': _('Turkish'),
'uk_UA': _('Ukrainian'),
'vi_VN': _('Vietnamese'),
'zh_CN': _('Chinese Simplified'),
'zh_TW': _('Chinese Traditional')
'ar_SA': 'Arabic',
'bg_BG': 'Bulgarian',
'cs_CZ': 'Czech',
'da_DK': 'Danish',
'de_DE': 'German',
'el_GR': 'Greek',
'eo_UY': 'Esperanto',
'en_UK': 'English', # selecting this guarantees seeing the untranslated source strings
'es_ES': 'Spanish',
'fa_IR': 'Persian',
'fr_FR': 'French',
'hu_HU': 'Hungarian',
'hy_AM': 'Armenian',
'id_ID': 'Indonesian',
'it_IT': 'Italian',
'ja_JP': 'Japanese',
'ky_KG': 'Kyrgyz',
'lv_LV': 'Latvian',
'nb_NO': 'Norwegian Bokmal',
'nl_NL': 'Dutch',
'pl_PL': 'Polish',
'pt_BR': 'Portuguese (Brazil)',
'pt_PT': 'Portuguese',
'ro_RO': 'Romanian',
'ru_RU': 'Russian',
'sk_SK': 'Slovak',
'sl_SI': 'Slovenian',
'sv_SE': 'Swedish',
'ta_IN': 'Tamil',
'th_TH': 'Thai',
'tr_TR': 'Turkish',
'uk_UA': 'Ukrainian',
'vi_VN': 'Vietnamese',
'zh_CN': 'Chinese Simplified',
'zh_TW': 'Chinese Traditional',
}
assert '' in languages