3
##############################################################################
5
# This script compiles all .po files available for the languages specified
6
# in the command line, or all available if none is specified.
8
# Usage: assumes to be called from base directory, and that every argument
9
# passed is a language code to compile. If no argument is passed, will compile
10
# every .po file found in po/ directories looking like ISO-639 language codes
12
##############################################################################
20
##############################################################################
22
# Merge & compile every .po file found in 'po/lang' directory
24
##############################################################################
26
sys.stdout.write("\t%s:\t" % lang)
28
for f in buildcat.do_find_files(("po/%s" % lang), ".*\.po$"):
29
# File names and paths to use
30
po = ("po/%s%s" % (lang, f))
31
pot = ("po/pot%st" % f)
32
mo = ("locale/%s/LC_MESSAGES%s" % (lang,
33
string.replace(f, ".po", ".mo")))
35
if not buildcat.do_buildpo(po, pot, "tmp.po"):
36
buildcat.do_makedirs(os.path.dirname(mo))
37
if not (os.system("msgfmt -o %s tmp.po" % mo)):
42
sys.stdout.write("\n")
45
##############################################################################
47
# Compile new translations from existing translations and freshly created .pot
50
##############################################################################
51
if __name__ == "__main__":
53
buildcat.do_check_root()
55
# Make sure .pot files are up to date.
56
buildcat.do_update_potfiles()
58
sys.stdout.write("Compiling translations: ")
61
# Assume all parameters are language codes to compile
65
# Find every directory that looks like ISO-639
66
lang = buildcat.do_find_dirs("po", buildcat.RE_ISO639)
67
print "all available."