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
|
from SCons.Script import Builder
from SCons.Action import Action
def addGettextBuilder(env):
env.Append(BUILDERS = {
'Gettext': Builder(
action = Action("$GETTEXTCOM", "$GETTEXTCOMSTR"),
suffix = '.mo',
src_suffix = '.po',
single_source = True,
),
'Xgettext': Builder(
action = Action("$XGETTEXTCOM", "$XGETTEXTCOMSTR"),
suffix = '.pot',
src_suffix = '.cpp',
single_source = False,
),
'Msgmerge': Builder(
action = Action("$MSGMERGECOM", "$MSGMERGECOMSTR"),
suffix = '.pot',
src_suffix = '.pot',
single_source = False,
),
'Msgcat': Builder(
action = Action("$MSGCATCOM", "$MSGCATCOMSTR"),
suffix = '.pot',
src_suffix = '.pot',
single_source = False,
),
})
env["GETTEXT"] = env.Detect("msgfmt")
env["GETTEXTCOM"] = "$GETTEXT --check-format --check-domain -f -o $TARGET $SOURCE"
env["XGETTEXT"] = env.Detect("xgettext")
env["XGETTEXTCOM"] = "$XGETTEXT --keyword=_ --from-code utf-8 --package-name=gpick $XGETTEXT_FLAGS --output=$TARGET $SOURCES"
env["MSGMERGE"] = env.Detect("msgmerge")
env["MSGMERGECOM"] = "$MSGMERGE $MSGMERGE_FLAGS --output-file=$TARGET $SOURCES"
env["MSGCAT"] = env.Detect("msgcat")
env["MSGCATCOM"] = "$MSGCAT $MSGCAT_FLAGS --output-file=$TARGET $SOURCES"
|