# HG changeset patch # User Edouard Tisserant # Date 1617285379 -7200 # Node ID 76f1cd1291f4143768ee285e17f0f6f18c370f72 # Parent d23f5117f6b078ce7ba97bc01ac2f7832b851e40 SVGHMI: Fixed last i18n changes meant to allow checking changes in PO files. Was making build exception when no PO files available. diff -r d23f5117f6b0 -r 76f1cd1291f4 svghmi/i18n.py --- a/svghmi/i18n.py Thu Apr 01 15:51:24 2021 +0200 +++ b/svghmi/i18n.py Thu Apr 01 15:56:19 2021 +0200 @@ -71,19 +71,17 @@ def GetPoFiles(dirpath): po_files = [fname for fname in os.listdir(dirpath) if fname.endswith(".po")] po_files.sort() - return po_files + return [(po_fname[:-3],os.path.join(dirpath, po_fname)) for po_fname in po_files] def ReadTranslations(dirpath): """ Read all PO files from a directory and return a list of (langcode, translation_dict) tuples """ - po_files = GetPoFiles(dirpath) - translations = [] - for po_fname in po_files: + for translation_name, po_path in GetPoFiles(dirpath): r = POReader() - with open(os.path.join(dirpath, po_fname), 'r') as PO_file: + with open(po_path, 'r') as PO_file: r.read(PO_file) - translations.append((po_fname[:-3], r.get_messages())) + translations.append((translation_name, r.get_messages())) return translations def MatchTranslations(translations, messages, errcallback): diff -r d23f5117f6b0 -r 76f1cd1291f4 svghmi/svghmi.py --- a/svghmi/svghmi.py Thu Apr 01 15:51:24 2021 +0200 +++ b/svghmi/svghmi.py Thu Apr 01 15:56:19 2021 +0200 @@ -451,8 +451,9 @@ hasher = hashlib.md5() hmi_tree_root._hash(hasher) + pofiles = GetPoFiles(self.CTNPath()) filestocheck = [svgfile] + \ - GetPoFiles(self.CTNPath()) + \ + (list(zip(*pofiles)[1]) if pofiles else []) + \ self.GetFontsFiles() for filetocheck in filestocheck: