Better filtering of translated languages

This commit is contained in:
Kovid Goyal 2023-08-27 20:41:41 +05:30
parent 9b12e0cb8d
commit 05a398750e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 4 deletions

View File

@ -275,10 +275,10 @@ class Translations(POT): # {{{
def is_po_file_ok(self, x):
bname = os.path.splitext(os.path.basename(x))[0]
# sr@latin.po is identical to sr.po. And we dont support country
# specific variants except for Portuguese and Chinese
return bname not in {
'sr@latin', 'en_AU', 'en_GB', 'en_CA', 'fr_CA', 'es_MX'
}
# specific variants except for a few.
if '_' in bname:
return bname.partition('_')[0] in ('pt', 'zh', 'bn')
return bname != 'sr@latin'
def po_files(self):
return [x for x in glob.glob(os.path.join(self.TRANSLATIONS, __appname__, '*.po')) if self.is_po_file_ok(x)]

View File

@ -328,6 +328,8 @@ _extra_lang_codes = {
'pt_BR' : _('Brazilian Portuguese'),
'zh_CN' : _('Simplified Chinese'),
'zh_TW' : _('Traditional Chinese'),
'bn_IN' : _('Indian Bengali'),
'bn_BD' : _('Bangladeshi Bengali'),
'en' : _('English'),
'und' : _('Unknown')
}