SVGHMI: Fixed last i18n changes meant to allow checking changes in PO files. Was making build exception when no PO files available.
--- 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):
--- 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: