Added gettext tool.

This commit is contained in:
Sergey Popov 2008-05-08 16:11:57 +00:00
parent 03f1af96f9
commit 6a559fe1e5
3 changed files with 23 additions and 6 deletions

View file

@ -73,7 +73,7 @@ opts.AddOptions(
# Setup
#
env = Environment(tools=["tar"], options = opts)
env = Environment(tools=["tar", "gettext"], options = opts, toolpath = ["scons"])
if env["PLATFORM"] == "win32":
env.Tool("mingw")
else:
@ -186,7 +186,7 @@ boost_test_dyn_link = boost_auto_test = False
if 'test' in COMMAND_LINE_TARGETS:
boost_test_dyn_link = boost_auto_test = conf.CheckBoost('unit_test_framework')
have_msgfmt = env.WhereIs("msgfmt")
have_msgfmt = env["MSGFMT"]
if not have_msgfmt:
env["nls"] = False
if not have_msgfmt:

View file

@ -132,9 +132,8 @@ if env["nls"]:
linguas = map(lingua_re.findall, pos)
for lingua in linguas:
lingua = lingua[0]
env.Command(
os.path.join("../translations", lingua, "LC_MESSAGES", domain+".mo"),
os.path.join(domain, lingua + ".po"),
"msgfmt -c --statistics -o $TARGET $SOURCE"
env.Msgfmt(
os.path.join("../translations", lingua, "LC_MESSAGES", domain),
os.path.join(domain, lingua)
)

18
scons/gettext.py Normal file
View file

@ -0,0 +1,18 @@
# vi: syntax=python:et:ts=4
from os.path import join
from SCons.Builder import Builder
from SCons.Script import *
def exists():
return True
def generate(env):
env.AppendENVPath("PATH", os.path.join(env["gettextdir"], "bin"))
env["MSGFMT"] = WhereIs("msgfmt")
msgfmt = Builder(
action = "$MSGFMT -c --statistics -o $TARGET $SOURCE",
src_suffix = ".po",
suffix = ".mo",
single_source = True
)
env["BUILDERS"]["Msgfmt"] = msgfmt