1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
2 | <!--
|
---|
3 | ** Internationalization
|
---|
4 | ** string extraction, merge, language file generation.
|
---|
5 | -->
|
---|
6 | <project name="plugin_i18n" basedir=".">
|
---|
7 | <property name="gettexttasks.jar" value="../../i18n/lib/gettext-ant-tasks-0.9.7.jar"/>
|
---|
8 | <property name="plugin.po.dir" location="po"/>
|
---|
9 | <property name="plugin.manifest" location="MANIFEST"/>
|
---|
10 |
|
---|
11 | <target name="gettext-init" description="Loads the Ant gettext and contrib tasks.">
|
---|
12 | <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
|
---|
13 | </target>
|
---|
14 | <target name="pot" description="Extract translatable strings from source." depends="gettext-init">
|
---|
15 | <mkdir dir="${plugin.po.dir}"/>
|
---|
16 | <gettext-extract keysFile="${ant.project.name}.pot" poDirectory="${plugin.po.dir}" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
17 | <fileset dir="src" includes="**/*.java"/>
|
---|
18 | </gettext-extract>
|
---|
19 | <echo file="${plugin.po.dir}/${ant.project.name}.pot" append="true">
|
---|
20 | #. Plugin ${ant.project.name}
|
---|
21 | #: build.xml:1
|
---|
22 | msgid "${plugin.description}"
|
---|
23 | msgstr ""
|
---|
24 | </echo>
|
---|
25 | </target>
|
---|
26 | <target name="pomerge" description="Merge extracted strings into language files.">
|
---|
27 | <exec executable="perl">
|
---|
28 | <arg value="i18n/pomerge.pl"/>
|
---|
29 | <arg value="--podir"/>
|
---|
30 | <arg value="${plugin.po.dir}"/>
|
---|
31 | <arg value="--project"/>
|
---|
32 | <arg value="${ant.project.name}"/>
|
---|
33 | </exec>
|
---|
34 | </target>
|
---|
35 | <target name="poimport" description="Import the PO files from the tarball launchpad-export.tar.gz exported from Launchpad.">
|
---|
36 | <exec executable="perl">
|
---|
37 | <arg value="i18n/poimport.pl"/>
|
---|
38 | <arg value="--podir"/>
|
---|
39 | <arg value="${plugin.po.dir}"/>
|
---|
40 | </exec>
|
---|
41 | </target>
|
---|
42 | <target name="lang" description="Prepare *.lang files in data directory.">
|
---|
43 | <exec executable="perl">
|
---|
44 | <arg line="../../i18n/i18n.pl data ${plugin.po.dir}/*.po"/>
|
---|
45 | </exec>
|
---|
46 | </target>
|
---|
47 | <target name="mftrans" description="Add translations of plugin description to manifest.">
|
---|
48 | <echo message="Adding translations to ${plugin.manifest} ..."/>
|
---|
49 | <exec executable="perl">
|
---|
50 | <arg value="i18n/mftrans.pl"/>
|
---|
51 | <arg value="--manifest"/>
|
---|
52 | <arg value="${plugin.manifest}"/>
|
---|
53 | <arg value="--description"/>
|
---|
54 | <arg value="${plugin.description}"/>
|
---|
55 | <arg value="${plugin.po.dir}/*.po"/>
|
---|
56 | </exec>
|
---|
57 | </target>
|
---|
58 | </project>
|
---|