[26174] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
[11529] | 2 | <project name="JOSM i18n" default="build" basedir=".">
|
---|
[26174] | 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"/>
|
---|
[33756] | 7 | <property name="maps.srcfile" value="https://josm.openstreetmap.de/maps"/>
|
---|
| 8 | <property name="wiki.srcfile" value="https://josm.openstreetmap.de/josmfile?mode=en"/>
|
---|
[26174] | 9 | <property name="surveyor.srcfile" value="${plugin.dir}/surveyor/resources/surveyor.xml"/>
|
---|
[33143] | 10 | <property name="tag2link.srcfile" value="${plugin.dir}/tag2link/resources/tag2link_sources.xml"/>
|
---|
[26174] | 11 | <property name="i18n.build.dir" value="build"/>
|
---|
| 12 | <property name="i18n.install.dir" value="${josm.build.dir}/data"/>
|
---|
[31111] | 13 | <property name="i18n_data.install.dir" value="${josm.build.dir}/data_nodist/trans"/>
|
---|
[26174] | 14 | <property name="po.build.dir" value="${i18n.build.dir}"/>
|
---|
| 15 | <property name="ant.build.javac.target" value="1.5"/>
|
---|
| 16 | <property name="gettexttasks.jar" value="lib/gettext-ant-tasks-0.9.7.jar"/>
|
---|
| 17 | <property name="antcontrib.jar" value="lib/ant-contrib-1.0b3.jar"/>
|
---|
| 18 | <target name="init" description="Loads the Ant gettext and contrib tasks">
|
---|
| 19 | <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
|
---|
[31111] | 20 | <!-- for the <foreach> possibility -->
|
---|
[26174] | 21 | <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${antcontrib.jar}"/>
|
---|
| 22 | </target>
|
---|
[30227] | 23 | <target name="builddir">
|
---|
[26174] | 24 | <mkdir dir="${i18n.build.dir}"/>
|
---|
[30227] | 25 | </target>
|
---|
| 26 | <target name="trans_.java" depends="builddir">
|
---|
[32268] | 27 | <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_presets.java">
|
---|
[26174] | 28 | <arg line="convpreset.pl ${josm.presets}"/>
|
---|
| 29 | </exec>
|
---|
[32268] | 30 | <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_maps.java">
|
---|
[31029] | 31 | <arg line="convmaps.pl ${maps.srcfile}"/>
|
---|
[26174] | 32 | </exec>
|
---|
[32268] | 33 | <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_surveyor.java">
|
---|
[26174] | 34 | <arg line="convsurveyor.pl ${surveyor.srcfile}"/>
|
---|
| 35 | </exec>
|
---|
[33143] | 36 | <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_tag2link.java">
|
---|
| 37 | <arg line="convtag2link.pl ${tag2link.srcfile}"/>
|
---|
| 38 | </exec>
|
---|
[32268] | 39 | <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_plugins.java">
|
---|
[26174] | 40 | <arg line="convplugins.pl ${plugin.dir}/*/build.xml"/>
|
---|
| 41 | </exec>
|
---|
[31111] | 42 | <exec executable="perl" failonerror="true">
|
---|
| 43 | <arg line="convwiki.pl ${wiki.srcfile} ${i18n.build.dir}/josmfiles ${i18n.build.dir}/josmfiles.zip"/>
|
---|
| 44 | </exec>
|
---|
[26174] | 45 | <copy file="specialmessages.java" todir="${i18n.build.dir}"/>
|
---|
| 46 | </target>
|
---|
[34023] | 47 | <!-- Create the file build/pluginSrc.txt, which contains a list of include patterns for all *.java files that should be translated relative to "${plugin.dir}" -->
|
---|
| 48 | <target name="filterpluginsources" depends="init">
|
---|
| 49 | <delete file="${po.build.dir}/pluginSrc.txt"/>
|
---|
| 50 | <foreach param="path" target="filterpluginsource">
|
---|
| 51 | <path>
|
---|
| 52 | <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
|
---|
| 53 | </path>
|
---|
| 54 | </foreach>
|
---|
| 55 | </target>
|
---|
| 56 | <!-- Helper task for `filterpluginsources`: Appends an include pattern to the file `build/pluginSrc.txt` if there is no file `.tx/config` for a plugin -->
|
---|
| 57 | <target name="filterpluginsource">
|
---|
| 58 | <if>
|
---|
| 59 | <not>
|
---|
| 60 | <available file="${path}/.tx/config" type="file" />
|
---|
| 61 | </not>
|
---|
| 62 | <then>
|
---|
| 63 | <basename file="${path}" property="dir"/>
|
---|
| 64 | <echo file="${po.build.dir}/pluginSrc.txt" append="true" message="${dir}/**/*.java
"></echo>
|
---|
| 65 | </then>
|
---|
| 66 | </if>
|
---|
| 67 | </target>
|
---|
| 68 | <target name="po/josm.pot" description="Extracts message keys from the source code" depends="trans_.java,init,filterpluginsources">
|
---|
[31901] | 69 | <gettext-extract keysFile="josm.raw.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
[34257] | 70 | <!-- core.pot -->
|
---|
[26174] | 71 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
---|
| 72 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
---|
[33486] | 73 | <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
|
---|
[33487] | 74 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
---|
| 75 | <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
|
---|
[34067] | 76 | <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
|
---|
[33487] | 77 | <!-- data.pot -->
|
---|
[33486] | 78 | <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
|
---|
[33487] | 79 | <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> disable for now -->
|
---|
| 80 | <!-- plugins.pot -->
|
---|
[34023] | 81 | <fileset dir="${plugin.dir}" includesfile="${po.build.dir}/pluginSrc.txt"/>
|
---|
[33486] | 82 | <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
|
---|
| 83 | <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
|
---|
[26174] | 84 | </gettext-extract>
|
---|
[31901] | 85 | <exec executable="msggrep" failonerror="true">
|
---|
| 86 | <arg line="--msgid --regexp='---DUMMY-MARKER---' --invert-match --output-file=po/josm.pot po/josm.raw.pot"/>
|
---|
| 87 | </exec>
|
---|
| 88 | <delete file="po/josm.raw.pot"/>
|
---|
[26174] | 89 | </target>
|
---|
[31111] | 90 | <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="trans_.java,init">
|
---|
[30227] | 91 | <gettext-extract keysFile="core.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
| 92 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
---|
| 93 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
---|
[31111] | 94 | <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
|
---|
[34068] | 95 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
---|
| 96 | <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
|
---|
[31111] | 97 | <!-- maps should be in data instead, but that requires language file loading support in trac python code -->
|
---|
| 98 | <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
|
---|
[30227] | 99 | </gettext-extract>
|
---|
| 100 | </target>
|
---|
[31111] | 101 | <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">
|
---|
[30227] | 102 | <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">
|
---|
[31111] | 103 | <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
|
---|
| 104 | <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> -->
|
---|
[30227] | 105 | </gettext-extract>
|
---|
[31111] | 106 | <copy todir="${po.build.dir}">
|
---|
| 107 | <fileset dir="po" includes="core.pot"/>
|
---|
| 108 | </copy>
|
---|
[30751] | 109 | <exec executable="msgcomm" failonerror="true" output="po/data.pot">
|
---|
[31111] | 110 | <arg line="--unique po/core.pot ${po.build.dir}/core.pot ${i18n.build.dir}/data.raw.pot"/>
|
---|
[30227] | 111 | </exec>
|
---|
[31111] | 112 | <delete file="${po.build.dir}/core.pot"/>
|
---|
| 113 | <delete file="${po.build.dir}/data.raw.pot"/>
|
---|
[30227] | 114 | </target>
|
---|
[31111] | 115 | <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">
|
---|
[30227] | 116 | <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">
|
---|
[34023] | 117 | <fileset dir="${plugin.dir}" includesfile="${po.build.dir}/pluginSrc.txt"/>
|
---|
[31111] | 118 | <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
|
---|
[33143] | 119 | <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
|
---|
[30227] | 120 | </gettext-extract>
|
---|
[31111] | 121 | <copy todir="${po.build.dir}">
|
---|
| 122 | <fileset dir="po" includes="core.pot"/>
|
---|
| 123 | <fileset dir="po" includes="data.pot"/>
|
---|
| 124 | </copy>
|
---|
[30751] | 125 | <exec executable="msgcomm" failonerror="true" output="po/plugins.pot">
|
---|
[31111] | 126 | <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"/>
|
---|
[30227] | 127 | </exec>
|
---|
[31111] | 128 | <delete file="${po.build.dir}/core.pot"/>
|
---|
| 129 | <delete file="${po.build.dir}/data.pot"/>
|
---|
| 130 | <delete file="${po.build.dir}/plugins.raw.pot"/>
|
---|
[30227] | 131 | </target>
|
---|
[31111] | 132 | <target name="build" depends="pot,allpot">
|
---|
[31900] | 133 | <antcall target="buildcore"/>
|
---|
| 134 | <antcall target="buildplugins"/>
|
---|
| 135 | </target>
|
---|
| 136 | <target name="buildplugins" depends="init">
|
---|
[33087] | 137 | <foreach param="path" target="plugintrans" parallel="true" maxThreads="8">
|
---|
[26174] | 138 | <path>
|
---|
[30754] | 139 | <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
|
---|
[26174] | 140 | </path>
|
---|
| 141 | </foreach>
|
---|
| 142 | </target>
|
---|
[31111] | 143 | <target name="singleplugintrans" depends="init">
|
---|
[30140] | 144 | <antcall target="plugintrans">
|
---|
| 145 | <param name="path" value="${plugin}"/>
|
---|
| 146 | </antcall>
|
---|
[30139] | 147 | </target>
|
---|
[31111] | 148 | <target name="buildcore" depends="po/core.pot,po/data.pot">
|
---|
[26928] | 149 | <antcall target="coretrans"/>
|
---|
[31111] | 150 | <antcall target="datatrans"/>
|
---|
[26928] | 151 | </target>
|
---|
[26174] | 152 | <target name="coretrans">
|
---|
[30751] | 153 | <exec executable="perl" failonerror="true">
|
---|
[31111] | 154 | <arg line="i18n.pl --potfile=po/core.pot --basedir=${i18n.install.dir}/ po/*.po"/>
|
---|
[26174] | 155 | </exec>
|
---|
| 156 | </target>
|
---|
[31111] | 157 | <target name="datatrans">
|
---|
| 158 | <exec executable="perl" failonerror="true">
|
---|
| 159 | <arg line="i18n.pl --potfile=po/data.pot --basedir=${i18n_data.install.dir}/ po/*.po"/>
|
---|
| 160 | </exec>
|
---|
| 161 | </target>
|
---|
[34023] | 162 | <!-- If the file `josm.pot` is present and the plugin has a `data/` directory, update its *.po files based on the ones in the `po/` directory. -->
|
---|
[34257] | 163 | <!-- If the plugin has a Transifex config file `.tx/config`, skip this target altogether -->
|
---|
[31111] | 164 | <target name="plugintrans">
|
---|
[34262] | 165 | <basename file="${path}" property="dir"/>
|
---|
[26174] | 166 | <if>
|
---|
[34262] | 167 | <available file="${plugin.dir}/${dir}/.tx/config" type="file"/>
|
---|
[26174] | 168 | <then>
|
---|
[34262] | 169 | <echo message="Skip plugin ${dir}, because it is translated with Transifex!"/>
|
---|
[34257] | 170 | </then>
|
---|
| 171 | <else>
|
---|
[34262] | 172 | <echo message="Run plugintrans target for plugin ${dir}" level="info"/>
|
---|
[34257] | 173 | <mkdir dir="${po.build.dir}/plugin_${dir}"/>
|
---|
| 174 | <exec executable="perl" failonerror="true" output="${po.build.dir}/plugin_${dir}/trans_plugin.java">
|
---|
| 175 | <arg line="convplugins.pl ${plugin.dir}/${dir}/build.xml"/>
|
---|
[26174] | 176 | </exec>
|
---|
[34257] | 177 | <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">
|
---|
| 178 | <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
|
---|
| 179 | <fileset dir="${po.build.dir}/plugin_${dir}" includes="trans_*.java"/>
|
---|
| 180 | <fileset dir="${i18n.build.dir}" includes="trans_${dir}.java"/> <!-- include plugin specific translation -->
|
---|
| 181 | </gettext-extract>
|
---|
| 182 | <if>
|
---|
| 183 | <and>
|
---|
| 184 | <available file="${po.build.dir}/plugin_${dir}/josm.pot" type="file"/>
|
---|
| 185 | <available file="${plugin.dir}/${dir}/data/" type="dir"/>
|
---|
| 186 | </and>
|
---|
| 187 | <then>
|
---|
| 188 | <exec executable="perl" failonerror="true">
|
---|
| 189 | <arg line="i18n.pl --potfile=${po.build.dir}/plugin_${dir}/josm.pot --basedir=${plugin.dir}/${dir}/data/ po/*.po"/>
|
---|
| 190 | </exec>
|
---|
| 191 | </then>
|
---|
| 192 | </if>
|
---|
| 193 | <delete dir="${po.build.dir}/plugin_${dir}"/>
|
---|
| 194 | </else>
|
---|
[26174] | 195 | </if>
|
---|
| 196 | </target>
|
---|
| 197 | <target name="clean">
|
---|
| 198 | <delete dir="${i18n.build.dir}"/>
|
---|
| 199 | <delete file="po/josm.pot"/>
|
---|
| 200 | <delete>
|
---|
| 201 | <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
|
---|
| 202 | </delete>
|
---|
[26928] | 203 | <delete>
|
---|
| 204 | <fileset dir="po" includes="*.po" defaultexcludes="false"/>
|
---|
| 205 | </delete>
|
---|
[26174] | 206 | </target>
|
---|
[31111] | 207 | <target name="test" depends="pot">
|
---|
[26849] | 208 | <mkdir dir="${i18n.build.dir}/test"/>
|
---|
[30751] | 209 | <exec executable="perl" failonerror="true">
|
---|
[31111] | 210 | <arg line="i18n.pl --potfile=po/josm.pot --basedir=${i18n.build.dir}/test/ po/*.po"/>
|
---|
[26849] | 211 | </exec>
|
---|
| 212 | </target>
|
---|
[26928] | 213 | <target name="pot" depends="po/josm.pot" />
|
---|
[31111] | 214 | <target name="allpot" depends="po/core.pot,po/data.pot,po/plugins.pot" />
|
---|
[26928] | 215 | <target name="update">
|
---|
[30751] | 216 | <exec executable="perl" failonerror="true">
|
---|
[26928] | 217 | <arg line="launchpad.pl bzronly"/>
|
---|
| 218 | </exec>
|
---|
[34023] | 219 | <antcall target="build"/>
|
---|
[26928] | 220 | </target>
|
---|
| 221 | <target name="updatecore">
|
---|
[30751] | 222 | <exec executable="perl" failonerror="true">
|
---|
[26928] | 223 | <arg line="launchpad.pl bzronly"/>
|
---|
| 224 | </exec>
|
---|
[34023] | 225 | <antcall target="buildcore"/>
|
---|
[26928] | 226 | </target>
|
---|
[11529] | 227 | </project>
|
---|