source: osm/applications/editors/josm/i18n/build.xml@ 33338

Last change on this file since 33338 was 33143, checked in by stoecker, 8 years ago

add tag2link translation parsing

File size: 10.3 KB
RevLine 
[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"/>
[31029]7 <property name="maps.srcfile" value="http://josm.openstreetmap.de/maps"/>
[31111]8 <property name="wiki.srcfile" value="http://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>
47 <target name="po/josm.pot" description="Extracts message keys from the source code" depends="trans_.java,init">
[31901]48 <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">
[26174]49 <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
50 <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
51 <fileset dir="${i18n.build.dir}" includes="trans_*.java"/>
[31111]52 <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> disable for now -->
[30239]53 <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
[30621]54 <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
[26174]55 <fileset dir="${plugin.dir}" includes="**/*.java"/>
56 </gettext-extract>
[31901]57 <exec executable="msggrep" failonerror="true">
58 <arg line="--msgid --regexp='---DUMMY-MARKER---' --invert-match --output-file=po/josm.pot po/josm.raw.pot"/>
59 </exec>
60 <delete file="po/josm.raw.pot"/>
[26174]61 </target>
[31111]62 <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="trans_.java,init">
[30227]63 <gettext-extract keysFile="core.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
64 <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
65 <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
[31111]66 <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
67 <!-- maps should be in data instead, but that requires language file loading support in trac python code -->
68 <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
69 <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
70 <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
[30227]71 </gettext-extract>
72 </target>
[31111]73 <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]74 <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]75 <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
76 <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> -->
[30227]77 </gettext-extract>
[31111]78 <copy todir="${po.build.dir}">
79 <fileset dir="po" includes="core.pot"/>
80 </copy>
[30751]81 <exec executable="msgcomm" failonerror="true" output="po/data.pot">
[31111]82 <arg line="--unique po/core.pot ${po.build.dir}/core.pot ${i18n.build.dir}/data.raw.pot"/>
[30227]83 </exec>
[31111]84 <delete file="${po.build.dir}/core.pot"/>
85 <delete file="${po.build.dir}/data.raw.pot"/>
[30227]86 </target>
[31111]87 <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]88 <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">
89 <fileset dir="${plugin.dir}" includes="**/*.java"/>
[31111]90 <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
[33143]91 <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
[30227]92 </gettext-extract>
[31111]93 <copy todir="${po.build.dir}">
94 <fileset dir="po" includes="core.pot"/>
95 <fileset dir="po" includes="data.pot"/>
96 </copy>
[30751]97 <exec executable="msgcomm" failonerror="true" output="po/plugins.pot">
[31111]98 <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]99 </exec>
[31111]100 <delete file="${po.build.dir}/core.pot"/>
101 <delete file="${po.build.dir}/data.pot"/>
102 <delete file="${po.build.dir}/plugins.raw.pot"/>
[30227]103 </target>
[31111]104 <target name="build" depends="pot,allpot">
[31900]105 <antcall target="buildcore"/>
106 <antcall target="buildplugins"/>
107 </target>
108 <target name="buildplugins" depends="init">
[33087]109 <foreach param="path" target="plugintrans" parallel="true" maxThreads="8">
[26174]110 <path>
[30754]111 <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
[26174]112 </path>
113 </foreach>
114 </target>
[31111]115 <target name="singleplugintrans" depends="init">
[30140]116 <antcall target="plugintrans">
117 <param name="path" value="${plugin}"/>
118 </antcall>
[30139]119 </target>
[31111]120 <target name="buildcore" depends="po/core.pot,po/data.pot">
[26928]121 <antcall target="coretrans"/>
[31111]122 <antcall target="datatrans"/>
[26928]123 </target>
[26174]124 <target name="coretrans">
[30751]125 <exec executable="perl" failonerror="true">
[31111]126 <arg line="i18n.pl --potfile=po/core.pot --basedir=${i18n.install.dir}/ po/*.po"/>
[26174]127 </exec>
128 </target>
[31111]129 <target name="datatrans">
130 <exec executable="perl" failonerror="true">
131 <arg line="i18n.pl --potfile=po/data.pot --basedir=${i18n_data.install.dir}/ po/*.po"/>
132 </exec>
133 </target>
134 <target name="plugintrans">
[26174]135 <basename file="${path}" property="dir"/>
136 <mkdir dir="${po.build.dir}/plugin_${dir}"/>
[30751]137 <exec executable="perl" failonerror="true" output="${po.build.dir}/plugin_${dir}/trans_plugin.java">
[30143]138 <arg line="convplugins.pl ${plugin.dir}/${dir}/build.xml"/>
139 </exec>
[26174]140 <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">
141 <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
[30143]142 <fileset dir="${po.build.dir}/plugin_${dir}" includes="trans_*.java"/>
[33143]143 <fileset dir="${i18n.build.dir}" includes="trans_${dir}.java"/> <!-- include plugin specific translation -->
[26174]144 </gettext-extract>
145 <if>
146 <available file="${po.build.dir}/plugin_${dir}/josm.pot"/>
147 <then>
[30751]148 <exec executable="perl" failonerror="true">
[31111]149 <arg line="i18n.pl --potfile=${po.build.dir}/plugin_${dir}/josm.pot --basedir=${plugin.dir}/${dir}/data/ po/*.po"/>
[26174]150 </exec>
151 </then>
152 </if>
[31126]153 <delete dir="${po.build.dir}/plugin_${dir}"/>
[26174]154 </target>
155 <target name="clean">
156 <delete dir="${i18n.build.dir}"/>
157 <delete file="po/josm.pot"/>
158 <delete>
159 <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
160 </delete>
[26928]161 <delete>
162 <fileset dir="po" includes="*.po" defaultexcludes="false"/>
163 </delete>
[26174]164 </target>
[31111]165 <target name="test" depends="pot">
[26849]166 <mkdir dir="${i18n.build.dir}/test"/>
[30751]167 <exec executable="perl" failonerror="true">
[31111]168 <arg line="i18n.pl --potfile=po/josm.pot --basedir=${i18n.build.dir}/test/ po/*.po"/>
[26849]169 </exec>
170 </target>
[26928]171 <target name="pot" depends="po/josm.pot" />
[31111]172 <target name="allpot" depends="po/core.pot,po/data.pot,po/plugins.pot" />
[26928]173 <target name="update">
[30751]174 <exec executable="perl" failonerror="true">
[26928]175 <arg line="launchpad.pl bzronly"/>
176 </exec>
177 <antcall target="build"/>
178 </target>
179 <target name="updatecore">
[30751]180 <exec executable="perl" failonerror="true">
[26928]181 <arg line="launchpad.pl bzronly"/>
182 </exec>
183 <antcall target="buildcore"/>
184 </target>
[11529]185</project>
Note: See TracBrowser for help on using the repository browser.