Support for translation tools such as msgfmt and intltool
Usage:
def configure(conf):
conf.load('gnu_dirs intltool')
def build(bld):
# process the .po files into .gmo files, and install them in LOCALEDIR
bld(features='intltool_po', appname='myapp', podir='po', install_path="${LOCALEDIR}")
# process an input file, substituting the translations from the po dir
bld(
features = "intltool_in",
podir = "../po",
flags = ["-d", "-q", "-u", "-c"],
source = 'kupfer.desktop.in',
install_path = "${DATADIR}/applications",
)
Usage of the waflib.Tools.gnu_dirs is recommended, but not obligatory.
Task generator method
Create tasks to translate files by intltool-merge:
def build(bld):
bld(
features = "intltool_in",
podir = "../po",
flags = ["-d", "-q", "-u", "-c"],
source = 'kupfer.desktop.in',
install_path = "${DATADIR}/applications",
)
Parameters: |
|
---|---|
Feature : |
Task generator method
Create tasks to process po files:
def build(bld):
bld(features='intltool_po', appname='myapp', podir='po', install_path="${LOCALEDIR}")
The relevant task generator arguments are:
Parameters: |
|
---|
The file LINGUAS must be present in the directory pointed by podir and list the translation files to process.
Feature : | intltool_po |
---|
Bases: waflib.Task.Task
Compile .po files into .gmo files
Bases: waflib.Task.Task
Let intltool-merge translate an input file
Detect the program msgfmt and set conf.env.MSGFMT. Detect the program intltool-merge and set conf.env.INTLTOOL. It is possible to set INTLTOOL in the environment, but it must not have spaces in it:
$ INTLTOOL="/path/to/the program/intltool" waf configure
If a C/C++ compiler is present, execute a compilation test to find the header locale.h.
Decorator: register a task generator method that will be executed when the object attribute ‘feature’ contains the corresponding key(s):
from waflib.Task import feature
@feature('myfeature')
def myfunction(self):
print('that is my feature!')
def build(bld):
bld(features='myfeature')
Parameters: | k (list of string) – feature names |
---|
Decorator: register a task generator method which will be executed before the functions of given name(s):
from waflib.TaskGen import feature, before
@feature('myfeature')
@before_method('fun2')
def fun1(self):
print('feature 1!')
@feature('myfeature')
def fun2(self):
print('feature 2!')
def build(bld):
bld(features='myfeature')
Parameters: | k (list of string) – method names |
---|
Wrap logging.errors, display the origin of the message when ‘-vv’ is set
Features defined in this module: