| 1 | <?xml version="1.0" encoding="utf-8"?>
|
|---|
| 2 | <project name="JOSM i18n" default="build" basedir=".">
|
|---|
| 3 | <!-- compilation properties -->
|
|---|
| 4 | <property name="josm.build.dir" value="../core"/>
|
|---|
| 5 | <property name="josm.presets" value="${josm.build.dir}/data/defaultpresets.xml"/>
|
|---|
| 6 | <property name="plugin.dir" value="../plugins"/>
|
|---|
| 7 | <property name="maps.srcfile" value="http://josm.openstreetmap.de/maps"/>
|
|---|
| 8 | <property name="wiki.srcfile" value="http://josm.openstreetmap.de/josmfile?mode=en"/>
|
|---|
| 9 | <property name="surveyor.srcfile" value="${plugin.dir}/surveyor/resources/surveyor.xml"/>
|
|---|
| 10 | <property name="i18n.build.dir" value="build"/>
|
|---|
| 11 | <property name="i18n.install.dir" value="${josm.build.dir}/data"/>
|
|---|
| 12 | <property name="i18n_data.install.dir" value="${josm.build.dir}/data_nodist/trans"/>
|
|---|
| 13 | <property name="po.build.dir" value="${i18n.build.dir}"/>
|
|---|
| 14 | <property name="ant.build.javac.target" value="1.5"/>
|
|---|
| 15 | <property name="gettexttasks.jar" value="lib/gettext-ant-tasks-0.9.7.jar"/>
|
|---|
| 16 | <property name="antcontrib.jar" value="lib/ant-contrib-1.0b3.jar"/>
|
|---|
| 17 | <target name="init" description="Loads the Ant gettext and contrib tasks">
|
|---|
| 18 | <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
|
|---|
| 19 | <!-- for the <foreach> possibility -->
|
|---|
| 20 | <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${antcontrib.jar}"/>
|
|---|
| 21 | </target>
|
|---|
| 22 | <target name="builddir">
|
|---|
| 23 | <mkdir dir="${i18n.build.dir}"/>
|
|---|
| 24 | </target>
|
|---|
| 25 | <target name="trans_.java" depends="builddir">
|
|---|
| 26 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_presets.java">
|
|---|
| 27 | <arg line="convpreset.pl ${josm.presets}"/>
|
|---|
| 28 | </exec>
|
|---|
| 29 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_maps.java">
|
|---|
| 30 | <arg line="convmaps.pl ${maps.srcfile}"/>
|
|---|
| 31 | </exec>
|
|---|
| 32 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_surveyor.java">
|
|---|
| 33 | <arg line="convsurveyor.pl ${surveyor.srcfile}"/>
|
|---|
| 34 | </exec>
|
|---|
| 35 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_plugins.java">
|
|---|
| 36 | <arg line="convplugins.pl ${plugin.dir}/*/build.xml"/>
|
|---|
| 37 | </exec>
|
|---|
| 38 | <exec executable="perl" failonerror="true">
|
|---|
| 39 | <arg line="convwiki.pl ${wiki.srcfile} ${i18n.build.dir}/josmfiles ${i18n.build.dir}/josmfiles.zip"/>
|
|---|
| 40 | </exec>
|
|---|
| 41 | <copy file="specialmessages.java" todir="${i18n.build.dir}"/>
|
|---|
| 42 | </target>
|
|---|
| 43 | <target name="po/josm.pot" description="Extracts message keys from the source code" depends="trans_.java,init">
|
|---|
| 44 | <gettext-extract keysFile="josm.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
|---|
| 45 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
|---|
| 46 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
|---|
| 47 | <fileset dir="${i18n.build.dir}" includes="trans_*.java"/>
|
|---|
| 48 | <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> disable for now -->
|
|---|
| 49 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
|---|
| 50 | <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
|
|---|
| 51 | <fileset dir="${plugin.dir}" includes="**/*.java"/>
|
|---|
| 52 | </gettext-extract>
|
|---|
| 53 | </target>
|
|---|
| 54 | <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="trans_.java,init">
|
|---|
| 55 | <gettext-extract keysFile="core.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
|---|
| 56 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
|---|
| 57 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
|---|
| 58 | <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
|
|---|
| 59 | <!-- maps should be in data instead, but that requires language file loading support in trac python code -->
|
|---|
| 60 | <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
|
|---|
| 61 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
|---|
| 62 | <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
|
|---|
| 63 | </gettext-extract>
|
|---|
| 64 | </target>
|
|---|
| 65 | <target name="po/data.pot" description="Extracts message keys from data files, e.g., presets, imagery (minus core strings)" depends="trans_.java,po/core.pot,init">
|
|---|
| 66 | <gettext-extract keysFile="data.raw.pot" poDirectory="${i18n.build.dir}" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
|---|
| 67 | <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
|
|---|
| 68 | <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> -->
|
|---|
| 69 | </gettext-extract>
|
|---|
| 70 | <copy todir="${po.build.dir}">
|
|---|
| 71 | <fileset dir="po" includes="core.pot"/>
|
|---|
| 72 | </copy>
|
|---|
| 73 | <exec executable="msgcomm" failonerror="true" output="po/data.pot">
|
|---|
| 74 | <arg line="--unique po/core.pot ${po.build.dir}/core.pot ${i18n.build.dir}/data.raw.pot"/>
|
|---|
| 75 | </exec>
|
|---|
| 76 | <delete file="${po.build.dir}/core.pot"/>
|
|---|
| 77 | <delete file="${po.build.dir}/data.raw.pot"/>
|
|---|
| 78 | </target>
|
|---|
| 79 | <target name="po/plugins.pot" description="Extracts message keys from the plugins source code (minus core and data strings)" depends="trans_.java,po/core.pot,po/data.pot,init">
|
|---|
| 80 | <gettext-extract keysFile="plugins.raw.pot" poDirectory="${i18n.build.dir}" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
|---|
| 81 | <fileset dir="${plugin.dir}" includes="**/*.java"/>
|
|---|
| 82 | <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
|
|---|
| 83 | </gettext-extract>
|
|---|
| 84 | <copy todir="${po.build.dir}">
|
|---|
| 85 | <fileset dir="po" includes="core.pot"/>
|
|---|
| 86 | <fileset dir="po" includes="data.pot"/>
|
|---|
| 87 | </copy>
|
|---|
| 88 | <exec executable="msgcomm" failonerror="true" output="po/plugins.pot">
|
|---|
| 89 | <arg line="--unique po/core.pot ${po.build.dir}/core.pot po/data.pot ${po.build.dir}/data.pot ${i18n.build.dir}/plugins.raw.pot"/>
|
|---|
| 90 | </exec>
|
|---|
| 91 | <delete file="${po.build.dir}/core.pot"/>
|
|---|
| 92 | <delete file="${po.build.dir}/data.pot"/>
|
|---|
| 93 | <delete file="${po.build.dir}/plugins.raw.pot"/>
|
|---|
| 94 | </target>
|
|---|
| 95 | <target name="build" depends="pot,allpot">
|
|---|
| 96 | <antcall target="coretrans"/>
|
|---|
| 97 | <antcall target="datatrans"/>
|
|---|
| 98 | <foreach param="path" target="plugintrans">
|
|---|
| 99 | <path>
|
|---|
| 100 | <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
|
|---|
| 101 | </path>
|
|---|
| 102 | </foreach>
|
|---|
| 103 | </target>
|
|---|
| 104 | <target name="singleplugintrans" depends="init">
|
|---|
| 105 | <antcall target="plugintrans">
|
|---|
| 106 | <param name="path" value="${plugin}"/>
|
|---|
| 107 | </antcall>
|
|---|
| 108 | </target>
|
|---|
| 109 | <target name="buildcore" depends="po/core.pot,po/data.pot">
|
|---|
| 110 | <antcall target="coretrans"/>
|
|---|
| 111 | <antcall target="datatrans"/>
|
|---|
| 112 | </target>
|
|---|
| 113 | <target name="coretrans">
|
|---|
| 114 | <exec executable="perl" failonerror="true">
|
|---|
| 115 | <arg line="i18n.pl --potfile=po/core.pot --basedir=${i18n.install.dir}/ po/*.po"/>
|
|---|
| 116 | </exec>
|
|---|
| 117 | </target>
|
|---|
| 118 | <target name="datatrans">
|
|---|
| 119 | <exec executable="perl" failonerror="true">
|
|---|
| 120 | <arg line="i18n.pl --potfile=po/data.pot --basedir=${i18n_data.install.dir}/ po/*.po"/>
|
|---|
| 121 | </exec>
|
|---|
| 122 | </target>
|
|---|
| 123 | <target name="plugintrans">
|
|---|
| 124 | <basename file="${path}" property="dir"/>
|
|---|
| 125 | <mkdir dir="${po.build.dir}/plugin_${dir}"/>
|
|---|
| 126 | <exec executable="perl" failonerror="true" output="${po.build.dir}/plugin_${dir}/trans_plugin.java">
|
|---|
| 127 | <arg line="convplugins.pl ${plugin.dir}/${dir}/build.xml"/>
|
|---|
| 128 | </exec>
|
|---|
| 129 | <gettext-extract keysFile="josm.pot" poDirectory="${po.build.dir}/plugin_${dir}" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
|---|
| 130 | <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
|
|---|
| 131 | <fileset dir="${po.build.dir}/plugin_${dir}" includes="trans_*.java"/>
|
|---|
| 132 | <fileset dir="${i18n.build.dir}" includes="trans_${dir}.java"/>
|
|---|
| 133 | </gettext-extract>
|
|---|
| 134 | <if>
|
|---|
| 135 | <available file="${po.build.dir}/plugin_${dir}/josm.pot"/>
|
|---|
| 136 | <then>
|
|---|
| 137 | <exec executable="perl" failonerror="true">
|
|---|
| 138 | <arg line="i18n.pl --potfile=${po.build.dir}/plugin_${dir}/josm.pot --basedir=${plugin.dir}/${dir}/data/ po/*.po"/>
|
|---|
| 139 | </exec>
|
|---|
| 140 | </then>
|
|---|
| 141 | </if>
|
|---|
| 142 | <delete dir="${po.build.dir}/plugin_${dir}"/>
|
|---|
| 143 | </target>
|
|---|
| 144 | <target name="clean">
|
|---|
| 145 | <delete dir="${i18n.build.dir}"/>
|
|---|
| 146 | <delete file="po/josm.pot"/>
|
|---|
| 147 | <delete>
|
|---|
| 148 | <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
|
|---|
| 149 | </delete>
|
|---|
| 150 | <delete>
|
|---|
| 151 | <fileset dir="po" includes="*.po" defaultexcludes="false"/>
|
|---|
| 152 | </delete>
|
|---|
| 153 | </target>
|
|---|
| 154 | <target name="test" depends="pot">
|
|---|
| 155 | <mkdir dir="${i18n.build.dir}/test"/>
|
|---|
| 156 | <exec executable="perl" failonerror="true">
|
|---|
| 157 | <arg line="i18n.pl --potfile=po/josm.pot --basedir=${i18n.build.dir}/test/ po/*.po"/>
|
|---|
| 158 | </exec>
|
|---|
| 159 | </target>
|
|---|
| 160 | <target name="pot" depends="po/josm.pot" />
|
|---|
| 161 | <target name="allpot" depends="po/core.pot,po/data.pot,po/plugins.pot" />
|
|---|
| 162 | <target name="update">
|
|---|
| 163 | <exec executable="perl" failonerror="true">
|
|---|
| 164 | <arg line="launchpad.pl bzronly"/>
|
|---|
| 165 | </exec>
|
|---|
| 166 | <antcall target="build"/>
|
|---|
| 167 | </target>
|
|---|
| 168 | <target name="updatecore">
|
|---|
| 169 | <exec executable="perl" failonerror="true">
|
|---|
| 170 | <arg line="launchpad.pl bzronly"/>
|
|---|
| 171 | </exec>
|
|---|
| 172 | <antcall target="buildcore"/>
|
|---|
| 173 | </target>
|
|---|
| 174 | </project>
|
|---|