Fix #2033192 [English appears three times and Spanish two times in the Choose language drop-down menu](https://bugs.launchpad.net/calibre/+bug/2033192)

This commit is contained in:
Kovid Goyal 2023-08-27 20:28:00 +05:30
parent 6966986ece
commit 9b12e0cb8d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -273,8 +273,12 @@ class Translations(POT): # {{{
f.write(h), f.write(data)
def is_po_file_ok(self, x):
# sr@latin.po is identical to sr.po
return os.path.splitext(os.path.basename(x))[0] != 'sr@latin'
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'
}
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)]