1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
from SCons.Script import *
def addGettextBuilder(env):
GettextAction = SCons.Action.Action("$GETTEXTCOM", "$GETTEXTCOMSTR")
env["GETTEXT"] = env.Detect("msgfmt")
env["GETTEXTCOM"] = "$GETTEXT --check-format --check-domain -f -o $TARGET $SOURCE"
builder = Builder(
action = GettextAction,
suffix = '.mo',
src_suffix = '.po',
single_source = True)
env.Append(BUILDERS = {'Gettext': builder})
XgettextAction = SCons.Action.Action("$XGETTEXTCOM", "$XGETTEXTCOMSTR")
env["XGETTEXT"] = env.Detect("xgettext")
env["XGETTEXTCOM"] = "$XGETTEXT --keyword=_ --from-code utf8 --package-name=gpick $XGETTEXT_FLAGS --output=$TARGET $SOURCES"
builder = Builder(
action = XgettextAction,
suffix = '.pot',
src_suffix = '.cpp',
single_source = False)
env.Append(BUILDERS = {'Xgettext': builder})
MsgmergeAction = SCons.Action.Action("$MSGMERGECOM", "$MSGMERGECOMSTR")
env["MSGMERGE"] = env.Detect("msgmerge")
env["MSGMERGECOM"] = "$MSGMERGE $MSGMERGE_FLAGS --output-file=$TARGET $SOURCES"
builder = Builder(
action = MsgmergeAction,
suffix = '.pot',
src_suffix = '.pot',
single_source = False)
env.Append(BUILDERS = {'Msgmerge': builder})
MsgcatAction = SCons.Action.Action("$MSGCATCOM", "$MSGCATCOMSTR")
env["MSGCAT"] = env.Detect("msgcat")
env["MSGCATCOM"] = "$MSGCAT $MSGCAT_FLAGS --output-file=$TARGET $SOURCES"
builder = Builder(
action = MsgcatAction,
suffix = '.pot',
src_suffix = '.pot',
single_source = False)
env.Append(BUILDERS = {'Msgcat': builder})
|