mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
checking in latest genpopo code - still not wrking
This commit is contained in:
parent
5268aa5802
commit
d96a600997
2 changed files with 39 additions and 16 deletions
4
web/lang/common_po.list
Normal file
4
web/lang/common_po.list
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# This file contains the list of text strings that appear
|
||||||
|
# in more than one PHP script. It only supports one line
|
||||||
|
# strings at the moment.
|
||||||
|
#
|
|
@ -7,9 +7,14 @@
|
||||||
# "xxx_po.inc" file in the 'lang' subdirectory and places the
|
# "xxx_po.inc" file in the 'lang' subdirectory and places the
|
||||||
# i18n strings into the file in the proper format.
|
# i18n strings into the file in the proper format.
|
||||||
#
|
#
|
||||||
|
# usage: genpopo [-v] [-f]
|
||||||
|
# -v: verbose, print duplicate terms that could be moved to common_po
|
||||||
|
# -f: force, overwrite existing translated files, otherwise append
|
||||||
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
print_dupes = '-v' in sys.argv
|
print_dupes = '-v' in sys.argv
|
||||||
|
force = '-f' in sys.argv
|
||||||
|
|
||||||
import re, os
|
import re, os
|
||||||
up = re.compile('_\(\s*"(([^"]|(?<=\\\\)["])+)"')
|
up = re.compile('_\(\s*"(([^"]|(?<=\\\\)["])+)"')
|
||||||
|
@ -29,8 +34,9 @@ for dir in ['../lang', 'lang']:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
f.close()
|
f.close()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
common[line[:-1]] = 0
|
if line[0] != '#':
|
||||||
lang['common_po.po'][line[:-1]] = 1
|
common[line[:-1]] = 0
|
||||||
|
lang['common_po.po'][line[:-1]] = 1
|
||||||
os.chdir(current_dir)
|
os.chdir(current_dir)
|
||||||
break
|
break
|
||||||
os.chdir(current_dir)
|
os.chdir(current_dir)
|
||||||
|
@ -105,23 +111,36 @@ for dir in ['../html', '../lib', 'html', 'lib']:
|
||||||
# if they do exist, only append new stuff to the end. If the 'force'
|
# if they do exist, only append new stuff to the end. If the 'force'
|
||||||
# option is passed, just overwrite the entire thing.
|
# option is passed, just overwrite the entire thing.
|
||||||
#
|
#
|
||||||
|
mapre = re.compile('^\$_t\["en\]["(.*)"].*$')
|
||||||
os.chdir(lang_dir)
|
os.chdir(lang_dir)
|
||||||
for po in lang.keys():
|
|
||||||
print "Generating %s..." % po
|
|
||||||
f = open(po,'w')
|
|
||||||
f.write("""# INSTRUCTIONS TO TRANSLATORS:
|
|
||||||
# blah blah blah....
|
|
||||||
""")
|
|
||||||
|
|
||||||
for term in lang[po].keys():
|
if force:
|
||||||
|
# just going to overwrite any existing files
|
||||||
|
#
|
||||||
|
for po in lang.keys():
|
||||||
|
print "Generating %s..." % po
|
||||||
|
|
||||||
|
f = open(po,'w')
|
||||||
|
f.write("<?\n")
|
||||||
|
f.write("""# INSTRUCTIONS TO TRANSLATORS:
|
||||||
|
# blah blah blah....
|
||||||
|
""")
|
||||||
|
|
||||||
|
for term in lang[po].keys():
|
||||||
|
f.write("\n");
|
||||||
|
f.write('$_t["en"]["%s"] = "%s";\n' % (term, term))
|
||||||
|
f.write('# $_t["es"]["%s"] = "--> Spanish translation here. <--";\n' % term)
|
||||||
|
f.write('# $_t["fr"]["%s"] = "--> French translation here. <--";\n' % term)
|
||||||
|
f.write('# $_t["de"]["%s"] = "--> German translation here. <--";\n' % term)
|
||||||
|
|
||||||
f.write("\n");
|
f.write("\n");
|
||||||
f.write('_$t["en"]["%s"] = "%s";\n' % (term, term))
|
f.write("?>");
|
||||||
f.write('# _$t["es"]["%s"] = "--> Spanish translation here. <--";\n' % term)
|
f.close()
|
||||||
f.write('# _$t["fr"]["%s"] = "--> French translation here. <--";\n' % term)
|
else:
|
||||||
f.write('# _$t["de"]["%s"] = "--> German translation here. <--";\n' % term)
|
# TODO left off here... need to leave existing file intact, and only
|
||||||
|
# append on terms that are new
|
||||||
f.write("\n");
|
#
|
||||||
f.close()
|
pass
|
||||||
|
|
||||||
# Print out warnings for unused and little-used common entries.
|
# Print out warnings for unused and little-used common entries.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue