mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Fix lyx_pot.py (handling of lib/language went terribly wrong)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18410 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4d5c28c305
commit
4ec7b36ab7
@ -120,22 +120,24 @@ def languages_l10n(input_files, output, base):
|
|||||||
'''Generate pot file from lib/language'''
|
'''Generate pot file from lib/language'''
|
||||||
output = open(output, 'w')
|
output = open(output, 'w')
|
||||||
# assuming only one language file
|
# 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])
|
input = open(input_files[0])
|
||||||
for lineno, line in enumerate(input.readlines()):
|
for lineno, line in enumerate(input.readlines()):
|
||||||
if line[0] == '#':
|
if line[0] == '#':
|
||||||
continue
|
continue
|
||||||
items = line.split()
|
|
||||||
# empty lines?
|
|
||||||
if len(items) < 3:
|
|
||||||
continue
|
|
||||||
# From:
|
# From:
|
||||||
# afrikaans afrikaans "Afrikaans" false iso8859-15 af_ZA ""
|
# afrikaans afrikaans "Afrikaans" false iso8859-15 af_ZA ""
|
||||||
# To:
|
# To:
|
||||||
# #: lib/languages:2
|
# #: lib/languages:2
|
||||||
# msgid "Afrikaans"
|
# msgid "Afrikaans"
|
||||||
# msgstr ""
|
# msgstr ""
|
||||||
# I do not care extra "s like "af_ZA"
|
if reg.match(line):
|
||||||
print >> output, '#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % (relativePath(input_files[0], base), lineno+1, items[2].strip('"'))
|
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()
|
input.close()
|
||||||
output.close()
|
output.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user