svghmi/i18n.py
branchsvghmi
changeset 3214 bb314cdfc656
parent 3198 d9c8f8789fc8
child 3218 76f1cd1291f4
equal deleted inserted replaced
3213:afef7011f475 3214:bb314cdfc656
    66     w.ImportMessages(messages)
    66     w.ImportMessages(messages)
    67 
    67 
    68     with open(fname, 'w') as POT_file:
    68     with open(fname, 'w') as POT_file:
    69         w.write(POT_file)
    69         w.write(POT_file)
    70 
    70 
       
    71 def GetPoFiles(dirpath):
       
    72     po_files = [fname for fname in os.listdir(dirpath) if fname.endswith(".po")]
       
    73     po_files.sort()
       
    74     return po_files
       
    75 
    71 def ReadTranslations(dirpath):
    76 def ReadTranslations(dirpath):
    72     """ Read all PO files from a directory and return a list of (langcode, translation_dict) tuples """
    77     """ Read all PO files from a directory and return a list of (langcode, translation_dict) tuples """
    73 
    78 
    74     po_files = [fname for fname in os.listdir(dirpath) if fname.endswith(".po")]
    79     po_files = GetPoFiles(dirpath)
    75     po_files.sort()
       
    76 
    80 
    77     translations = []
    81     translations = []
    78     for po_fname in po_files:
    82     for po_fname in po_files:
    79         r = POReader()
    83         r = POReader()
    80         with open(os.path.join(dirpath, po_fname), 'r') as PO_file:
    84         with open(os.path.join(dirpath, po_fname), 'r') as PO_file: