]> git.lyx.org Git - lyx.git/blobdiff - po/lyx_pot.py
EmbeddedObjects.lyx: add hint how to force a rotation direction for rotated floats
[lyx.git] / po / lyx_pot.py
index ce7b68a35812f72214c3f501a5c2ff7c2d7bd4af..fb7578d026412d82bdd0a58b7c5d08ab9835004a 100755 (executable)
@@ -38,6 +38,7 @@ def ui_l10n(input_files, output, base):
     Popupmenu = re.compile(r'^[^#]*PopupMenu\s+"[^"]+"\s+"([^"]*)"')
     Toolbar = re.compile(r'^[^#]*Toolbar\s+"[^"]+"\s+"([^"]*)"')
     Item = re.compile(r'[^#]*Item\s+"([^"]*)"')
+    TableInsert = re.compile(r'[^#]*TableInsert\s+"([^"]*)"')
     for src in input_files:
         input = open(src)
         for lineno, line in enumerate(input.readlines()):
@@ -50,6 +51,8 @@ def ui_l10n(input_files, output, base):
                 (string,) = Toolbar.match(line).groups()
             elif Item.match(line):
                 (string,) = Item.match(line).groups()
+            elif TableInsert.match(line):
+                (string,) = TableInsert.match(line).groups()
             else:
                 continue
             string = string.replace('"', '')
@@ -120,22 +123,24 @@ def languages_l10n(input_files, output, base):
     '''Generate pot file from lib/language'''
     output = open(output, 'w')
     # assuming only one language file
+    reg = re.compile('[\w-]+\s+[\w"]+\s+"([\w \-\(\)]+)"\s+(true|false)\s+[\w-]+\s+\w+\s+"[^"]*"')
     input = open(input_files[0])
     for lineno, line in enumerate(input.readlines()):
         if line[0] == '#':
             continue
-        items = line.split()
-        # empty lines?
-        if len(items) < 3:
-            continue
         # From:
         #   afrikaans   afrikaans      "Afrikaans"     false  iso8859-15 af_ZA  ""
         # To:
         #   #: lib/languages:2
         #   msgid "Afrikaans"
         #   msgstr ""
-        # I do not care extra "s like "af_ZA"
-        print >> output, '#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % (relativePath(input_files[0], base), lineno+1, items[2].strip('"'))
+        if reg.match(line):
+            print >> output, '#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % \
+                (relativePath(input_files[0], base), lineno+1, reg.match(line).groups()[0])
+        else:
+            print "Error: Unable to handle line:"
+            print line
+            sys.exit(1)
     input.close()
     output.close()