File: gettext.py

package info (click to toggle)
gpick 0.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,400 kB
  • ctags: 3,306
  • sloc: cpp: 22,216; python: 740; ansic: 476; yacc: 252; lex: 197; makefile: 49; xml: 11; sh: 8
file content (56 lines) | stat: -rw-r--r-- 1,534 bytes parent folder | download
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})