Skip to content

Commit b6e7828

Browse files
authored
Merge pull request #63 from NSoiffer/GUIAddLanguageVariantTextDescriptions
Update MathCATPreferences.py
2 parents 9014781 + 9d192bd commit b6e7828

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

addon/globalPlugins/MathCAT/MathCATPreferences.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def LanguagesDict():
110110
"ee": "Ɛʋɛ",
111111
"el": "Ελληνικά",
112112
"en": "English",
113+
"en-GB": "English, United Kingdom",
114+
"en-US": "English, United States",
113115
"eo": "Esperanto",
114116
"es": "Español",
115117
"fa": "فارسی",
@@ -240,6 +242,9 @@ def LanguagesDict():
240242
"yo": "Yorùbá",
241243
"za": "Cuengh / Tôô / 壮语",
242244
"zh": "中文",
245+
"zh-HANS": "Chinese, Simplified",
246+
"zh-HANT": "Chinese, Traditional",
247+
"zh-TW": "Chinese, Traditional, Taiwan",
243248
"zu": "isiZulu"
244249
}
245250
return languages
@@ -258,21 +263,24 @@ def GetLanguages(self):
258263
#only add this language if there is a xxx_Rules.yaml file
259264
files = glob.glob(os.path.join(path_to_language_folder,"*_Rules.yaml"))
260265
if files:
261-
#add to the listbox the text for this language together with the language code
266+
#add to the listbox the text for this language together with the code
262267
if languages_dict.get(language, 'missing') != 'missing':
263268
self.m_choiceLanguage.Append(languages_dict[language] + " (" + language + ")")
264269
else:
265270
self.m_choiceLanguage.Append(language + " (" + language + ")")
266-
#the country variants are in folders named using ISO 3166-1 alpha-2 codes https://en.wikipedia.org/wiki/ISO_3166-2
267-
#check if there are countries in the language folder
268-
for country in os.listdir(path_to_language_folder):
269-
if os.path.isdir(os.path.join(path_to_language_folder, country)):
270-
if country != "SharedRules":
271-
#add to the listbox the text for this language together with the language and country codes
272-
if languages_dict.get(language, 'missing') != 'missing':
273-
self.m_choiceLanguage.Append(languages_dict[language] + " (" + language + "-" + country + ")")
271+
#the language variants are in folders named using ISO 3166-1 alpha-2 codes https://en.wikipedia.org/wiki/ISO_3166-2
272+
#check if there are language variants in the language folder
273+
for variant in os.listdir(path_to_language_folder):
274+
if os.path.isdir(os.path.join(path_to_language_folder, variant)):
275+
if variant != "SharedRules":
276+
#add to the listbox the text for this language variant together with the code
277+
if languages_dict.get(language + "-" + variant.upper(), 'missing') != 'missing':
278+
self.m_choiceLanguage.Append(languages_dict[language + "-" + variant.upper()] + " (" + language + "-" + variant + ")")
274279
else:
275-
self.m_choiceLanguage.Append(language + " (" + language + "-" + country + ")")
280+
if languages_dict.get(language, 'missing') != 'missing':
281+
self.m_choiceLanguage.Append(languages_dict[language] + " (" + language + "-" + variant + ")")
282+
else:
283+
self.m_choiceLanguage.Append(language + " (" + language + "-" + variant + ")")
276284

277285
def GetLanguageCode(self):
278286
lang_selection = self.m_choiceLanguage.GetStringSelection()

0 commit comments

Comments
 (0)