| 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" value="po"/>
|
|---|
| 9 | <property name="poimport.tarball" value="latest"/>
|
|---|
| 10 | <property name="plugin.manifest" location="MANIFEST"/>
|
|---|
| 11 |
|
|---|
| 12 | <target name="gettext-init" description="Loads the Ant gettext and contrib tasks.">
|
|---|
| 13 | <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
|
|---|
| 14 | </target>
|
|---|
| 15 | <target name="pot" description="Extract translatable strings from source." depends="gettext-init">
|
|---|
| 16 | <mkdir dir="${plugin.po.dir}"/>
|
|---|
| 17 | <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">
|
|---|
| 18 | <fileset dir="${plugin.src.dir}" includes="**/*.java"/>
|
|---|
| 19 | </gettext-extract>
|
|---|
| 20 | <echo file="${plugin.po.dir}/${ant.project.name}.pot" append="true">
|
|---|
| 21 | #. Plugin ${ant.project.name}
|
|---|
| 22 | #: build.xml:1
|
|---|
| 23 | msgid "${plugin.description}"
|
|---|
| 24 | msgstr ""
|
|---|
| 25 | </echo>
|
|---|
| 26 | </target>
|
|---|
| 27 | <target name="pomerge" description="Merge extracted strings into language files.">
|
|---|
| 28 | <exec executable="perl">
|
|---|
| 29 | <arg value="i18n/pomerge.pl"/>
|
|---|
| 30 | <arg value="--podir"/>
|
|---|
| 31 | <arg value="${plugin.po.dir}"/>
|
|---|
| 32 | <arg value="--project"/>
|
|---|
| 33 | <arg value="${ant.project.name}"/>
|
|---|
| 34 | </exec>
|
|---|
| 35 | </target>
|
|---|
| 36 | <target name="poimport" description="Import the PO files from Launchpad tarball.">
|
|---|
| 37 | <exec executable="perl">
|
|---|
| 38 | <arg value="i18n/poimport.pl"/>
|
|---|
| 39 | <arg value="--podir"/>
|
|---|
| 40 | <arg value="${plugin.po.dir}"/>
|
|---|
| 41 | <arg value="${poimport.tarball}"/>
|
|---|
| 42 | </exec>
|
|---|
| 43 | </target>
|
|---|
| 44 | <target name="lang" description="Prepare *.lang files in data directory.">
|
|---|
| 45 | <exec executable="perl">
|
|---|
| 46 | <arg line="../../i18n/i18n.pl --potfile=${plugin.po.dir}/${ant.project.name}.pot --basedir=data/ ${plugin.po.dir}/*.po"/>
|
|---|
| 47 | </exec>
|
|---|
| 48 | </target>
|
|---|
| 49 |
|
|---|
| 50 | <target name="mftrans" description="Add translations of plugin description to manifest. Not to be called directly.">
|
|---|
| 51 | <echo message="Adding translations to ${plugin.manifest} ..."/>
|
|---|
| 52 | <exec executable="perl">
|
|---|
| 53 | <arg value="i18n/mftrans.pl"/>
|
|---|
| 54 | <arg value="--manifest"/>
|
|---|
| 55 | <arg value="${plugin.manifest}"/>
|
|---|
| 56 | <arg value="--description"/>
|
|---|
| 57 | <arg value="${plugin.description}"/>
|
|---|
| 58 | <arg value="${plugin.po.dir}/*.po"/>
|
|---|
| 59 | </exec>
|
|---|
| 60 | </target>
|
|---|
| 61 | </project>
|
|---|