Example #1
0
    def removeComments(self):

        getter = POBasic(self.po_dir, False)
        po_dir_list = getter.getSortedPOFileList()

        p = re.compile(Common.COMMENTED_LINE)
        update_count=0
        for(index, po_file_path) in enumerate(po_dir_list):
            if (len(po_file_path) <= 0):
                continue

            read_text = self.readFile(po_file_path)
            if (read_text == None):
                raise Exception("Unable to read text from file: {}".format(self.path))

            m = p.search(read_text)
            if (m == None):
                continue

            print("doc: {}".format(po_file_path))

            po_doc = Document(po_file_path)
            po_doc.loadText()
            po_doc.cleanupEmpties()

            print("po_doc: {}".format(po_doc.getTextWithIDFlat()))
            po_doc.saveText()
            update_count += 1
Example #2
0
 def listMSGID(self):
     getter_from = POBasic(self.target_dir, False)
     target_dir_list = getter_from.getSortedPOFileList()
     for (index, file_name) in enumerate(target_dir_list):
         po_doc = Document(file_name)
         po_doc.loadText()
         po_doc.printTitleOnce()
         print("{}\n\n".format(po_doc.getTextWithIDFlat()))