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

Last change on this file since 33691 was 33487, checked in by stoecker, 7 years ago

unify order of translations between different outputs

File size: 10.7 KB
Line 
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="tag2link.srcfile" value="${plugin.dir}/tag2link/resources/tag2link_sources.xml"/>
11 <property name="i18n.build.dir" value="build"/>
12 <property name="i18n.install.dir" value="${josm.build.dir}/data"/>
13 <property name="i18n_data.install.dir" value="${josm.build.dir}/data_nodist/trans"/>
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}"/>
20 <!-- for the <foreach> possibility -->
21 <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${antcontrib.jar}"/>
22 </target>
23 <target name="builddir">
24 <mkdir dir="${i18n.build.dir}"/>
25 </target>
26 <target name="trans_.java" depends="builddir">
27 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_presets.java">
28 <arg line="convpreset.pl ${josm.presets}"/>
29 </exec>
30 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_maps.java">
31 <arg line="convmaps.pl ${maps.srcfile}"/>
32 </exec>
33 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_surveyor.java">
34 <arg line="convsurveyor.pl ${surveyor.srcfile}"/>
35 </exec>
36 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_tag2link.java">
37 <arg line="convtag2link.pl ${tag2link.srcfile}"/>
38 </exec>
39 <exec executable="perl" failonerror="true" logError="true" output="${i18n.build.dir}/trans_plugins.java">
40 <arg line="convplugins.pl ${plugin.dir}/*/build.xml"/>
41 </exec>
42 <exec executable="perl" failonerror="true">
43 <arg line="convwiki.pl ${wiki.srcfile} ${i18n.build.dir}/josmfiles ${i18n.build.dir}/josmfiles.zip"/>
44 </exec>
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">
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">
49 <!-- core.port -->
50 <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
51 <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
52 <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
53 <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
54 <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
55 <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
56 <!-- data.pot -->
57 <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
58 <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> disable for now -->
59 <!-- plugins.pot -->
60 <fileset dir="${plugin.dir}" includes="**/*.java"/>
61 <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
62 <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
63 </gettext-extract>
64 <exec executable="msggrep" failonerror="true">
65 <arg line="--msgid --regexp='---DUMMY-MARKER---' --invert-match --output-file=po/josm.pot po/josm.raw.pot"/>
66 </exec>
67 <delete file="po/josm.raw.pot"/>
68 </target>
69 <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="trans_.java,init">
70 <gettext-extract keysFile="core.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
71 <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
72 <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
73 <fileset dir="${i18n.build.dir}" includes="trans_presets.java"/>
74 <!-- maps should be in data instead, but that requires language file loading support in trac python code -->
75 <fileset dir="${i18n.build.dir}" includes="trans_maps.java"/>
76 <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
77 <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
78 </gettext-extract>
79 </target>
80 <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">
81 <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">
82 <fileset dir="${i18n.build.dir}" includes="trans_plugins.java"/>
83 <!-- <fileset dir="${i18n.build.dir}/josmfiles" includes="trans_*.*"/> -->
84 </gettext-extract>
85 <copy todir="${po.build.dir}">
86 <fileset dir="po" includes="core.pot"/>
87 </copy>
88 <exec executable="msgcomm" failonerror="true" output="po/data.pot">
89 <arg line="--unique po/core.pot ${po.build.dir}/core.pot ${i18n.build.dir}/data.raw.pot"/>
90 </exec>
91 <delete file="${po.build.dir}/core.pot"/>
92 <delete file="${po.build.dir}/data.raw.pot"/>
93 </target>
94 <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">
95 <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">
96 <fileset dir="${plugin.dir}" includes="**/*.java"/>
97 <fileset dir="${i18n.build.dir}" includes="trans_surveyor.java"/>
98 <fileset dir="${i18n.build.dir}" includes="trans_tag2link.java"/>
99 </gettext-extract>
100 <copy todir="${po.build.dir}">
101 <fileset dir="po" includes="core.pot"/>
102 <fileset dir="po" includes="data.pot"/>
103 </copy>
104 <exec executable="msgcomm" failonerror="true" output="po/plugins.pot">
105 <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"/>
106 </exec>
107 <delete file="${po.build.dir}/core.pot"/>
108 <delete file="${po.build.dir}/data.pot"/>
109 <delete file="${po.build.dir}/plugins.raw.pot"/>
110 </target>
111 <target name="build" depends="pot,allpot">
112 <antcall target="buildcore"/>
113 <antcall target="buildplugins"/>
114 </target>
115 <target name="buildplugins" depends="init">
116 <foreach param="path" target="plugintrans" parallel="true" maxThreads="8">
117 <path>
118 <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
119 </path>
120 </foreach>
121 </target>
122 <target name="singleplugintrans" depends="init">
123 <antcall target="plugintrans">
124 <param name="path" value="${plugin}"/>
125 </antcall>
126 </target>
127 <target name="buildcore" depends="po/core.pot,po/data.pot">
128 <antcall target="coretrans"/>
129 <antcall target="datatrans"/>
130 </target>
131 <target name="coretrans">
132 <exec executable="perl" failonerror="true">
133 <arg line="i18n.pl --potfile=po/core.pot --basedir=${i18n.install.dir}/ po/*.po"/>
134 </exec>
135 </target>
136 <target name="datatrans">
137 <exec executable="perl" failonerror="true">
138 <arg line="i18n.pl --potfile=po/data.pot --basedir=${i18n_data.install.dir}/ po/*.po"/>
139 </exec>
140 </target>
141 <target name="plugintrans">
142 <basename file="${path}" property="dir"/>
143 <mkdir dir="${po.build.dir}/plugin_${dir}"/>
144 <exec executable="perl" failonerror="true" output="${po.build.dir}/plugin_${dir}/trans_plugin.java">
145 <arg line="convplugins.pl ${plugin.dir}/${dir}/build.xml"/>
146 </exec>
147 <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">
148 <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
149 <fileset dir="${po.build.dir}/plugin_${dir}" includes="trans_*.java"/>
150 <fileset dir="${i18n.build.dir}" includes="trans_${dir}.java"/> <!-- include plugin specific translation -->
151 </gettext-extract>
152 <if>
153 <available file="${po.build.dir}/plugin_${dir}/josm.pot"/>
154 <then>
155 <exec executable="perl" failonerror="true">
156 <arg line="i18n.pl --potfile=${po.build.dir}/plugin_${dir}/josm.pot --basedir=${plugin.dir}/${dir}/data/ po/*.po"/>
157 </exec>
158 </then>
159 </if>
160 <delete dir="${po.build.dir}/plugin_${dir}"/>
161 </target>
162 <target name="clean">
163 <delete dir="${i18n.build.dir}"/>
164 <delete file="po/josm.pot"/>
165 <delete>
166 <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
167 </delete>
168 <delete>
169 <fileset dir="po" includes="*.po" defaultexcludes="false"/>
170 </delete>
171 </target>
172 <target name="test" depends="pot">
173 <mkdir dir="${i18n.build.dir}/test"/>
174 <exec executable="perl" failonerror="true">
175 <arg line="i18n.pl --potfile=po/josm.pot --basedir=${i18n.build.dir}/test/ po/*.po"/>
176 </exec>
177 </target>
178 <target name="pot" depends="po/josm.pot" />
179 <target name="allpot" depends="po/core.pot,po/data.pot,po/plugins.pot" />
180 <target name="update">
181 <exec executable="perl" failonerror="true">
182 <arg line="launchpad.pl bzronly"/>
183 </exec>
184 <antcall target="build"/>
185 </target>
186 <target name="updatecore">
187 <exec executable="perl" failonerror="true">
188 <arg line="launchpad.pl bzronly"/>
189 </exec>
190 <antcall target="buildcore"/>
191 </target>
192</project>
Note: See TracBrowser for help on using the repository browser.