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="josm.style" value="${josm.build.dir}/styles/standard/elemstyles.xml"/>-->
|
---|
7 | <property name="plugin.dir" value="../plugins"/>
|
---|
8 | <property name="validator.tagfile" value="${josm.build.dir}/data/validator/tagchecker.cfg"/>
|
---|
9 | <property name="wms.srcfile" value="http://josm.openstreetmap.de/maps"/>
|
---|
10 | <property name="surveyor.srcfile" value="${plugin.dir}/surveyor/resources/surveyor.xml"/>
|
---|
11 | <property name="i18n.build.dir" value="build"/>
|
---|
12 | <property name="i18n.install.dir" value="${josm.build.dir}/data"/>
|
---|
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 | <taskdef name="gettext-merge" classname="org.xnap.commons.ant.gettext.GettextMergeKeysTask" classpath="${gettexttasks.jar}"/>
|
---|
20 | <taskdef name="gettext-dist" classname="org.xnap.commons.ant.gettext.GettextDistTask" classpath="${gettexttasks.jar}"/>
|
---|
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" output="${i18n.build.dir}/trans_presets.java">
|
---|
28 | <arg line="convpreset.pl ${josm.presets}"/>
|
---|
29 | </exec>
|
---|
30 | <!--<exec executable="perl" output="${i18n.build.dir}/trans_style.java">
|
---|
31 | <arg line="convstyle.pl ${josm.style}"/>
|
---|
32 | </exec>-->
|
---|
33 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_validator.java">
|
---|
34 | <arg line="convvalidator.pl ${validator.tagfile}"/>
|
---|
35 | </exec>
|
---|
36 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_wms.java">
|
---|
37 | <arg line="convwms.pl ${wms.srcfile}"/>
|
---|
38 | </exec>
|
---|
39 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_surveyor.java">
|
---|
40 | <arg line="convsurveyor.pl ${surveyor.srcfile}"/>
|
---|
41 | </exec>
|
---|
42 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_plugins.java">
|
---|
43 | <arg line="convplugins.pl ${plugin.dir}/*/build.xml"/>
|
---|
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.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
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"/>
|
---|
52 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
---|
53 | <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
|
---|
54 | <fileset dir="${plugin.dir}" includes="**/*.java"/>
|
---|
55 | </gettext-extract>
|
---|
56 | </target>
|
---|
57 | <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="builddir,init">
|
---|
58 | <gettext-extract keysFile="core.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
59 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
---|
60 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
---|
61 | </gettext-extract>
|
---|
62 | </target>
|
---|
63 | <target name="${i18n.build.dir}/core.2.pot" depends="builddir,po/core.pot" description="Duplicates core.pot for de-duplication in data.pot and plugins.pot">
|
---|
64 | <copy file="po/core.pot" tofile="${i18n.build.dir}/core.2.pot"/>
|
---|
65 | </target>
|
---|
66 | <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,${i18n.build.dir}/core.2.pot,init">
|
---|
67 | <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">
|
---|
68 | <fileset dir="${i18n.build.dir}" includes="trans_*.java"/>
|
---|
69 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
---|
70 | <fileset dir="${josm.build.dir}/styles/standard" includes="*.mapcss"/>
|
---|
71 | </gettext-extract>
|
---|
72 | <exec executable="msgcomm" failonerror="true" output="po/data.pot">
|
---|
73 | <arg line="--unique po/core.pot ${i18n.build.dir}/core.2.pot ${i18n.build.dir}/data.raw.pot"/>
|
---|
74 | </exec>
|
---|
75 | </target>
|
---|
76 | <target name="po/plugins.pot" description="Extracts message keys from the plugins source code (minus core strings)" depends="po/core.pot,${i18n.build.dir}/core.2.pot,init">
|
---|
77 | <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">
|
---|
78 | <fileset dir="${plugin.dir}" includes="**/*.java"/>
|
---|
79 | </gettext-extract>
|
---|
80 | <exec executable="msgcomm" failonerror="true" output="po/plugins.pot">
|
---|
81 | <arg line="--unique po/core.pot ${i18n.build.dir}/core.2.pot ${i18n.build.dir}/plugins.raw.pot"/>
|
---|
82 | </exec>
|
---|
83 | </target>
|
---|
84 | <target name="build" depends="po/josm.pot,init">
|
---|
85 | <gettext-merge keysFile="josm.pot" poDirectory="po"/>
|
---|
86 | <antcall target="coretrans"/>
|
---|
87 | <foreach param="path" target="plugintrans">
|
---|
88 | <path>
|
---|
89 | <dirset dir="${plugin.dir}" includes="*" excludes="00_*" />
|
---|
90 | </path>
|
---|
91 | </foreach>
|
---|
92 | </target>
|
---|
93 | <target name="singleplugintrans" depends="po/josm.pot,init">
|
---|
94 | <antcall target="plugintrans">
|
---|
95 | <param name="path" value="${plugin}"/>
|
---|
96 | </antcall>
|
---|
97 | </target>
|
---|
98 | <target name="buildcore" depends="po/josm.pot,init">
|
---|
99 | <gettext-merge keysFile="josm.pot" poDirectory="po"/>
|
---|
100 | <antcall target="coretrans"/>
|
---|
101 | </target>
|
---|
102 | <target name="coretrans">
|
---|
103 | <mkdir dir="${po.build.dir}/core"/>
|
---|
104 | <gettext-extract keysFile="josm.pot" poDirectory="${po.build.dir}/core" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
105 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
---|
106 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
---|
107 | <fileset dir="${i18n.build.dir}" includes="trans_*.java"/>
|
---|
108 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
---|
109 | </gettext-extract>
|
---|
110 | <copy todir="${po.build.dir}/core">
|
---|
111 | <fileset dir="po"/>
|
---|
112 | </copy>
|
---|
113 | <gettext-merge keysFile="josm.pot" poDirectory="${po.build.dir}/core"/>
|
---|
114 | <exec executable="perl" failonerror="true">
|
---|
115 | <arg line="i18n.pl ${i18n.install.dir}/ ${po.build.dir}/core/*.po"/>
|
---|
116 | </exec>
|
---|
117 | </target>
|
---|
118 | <target name="plugintrans" depends="init">
|
---|
119 | <basename file="${path}" property="dir"/>
|
---|
120 | <mkdir dir="${po.build.dir}/plugin_${dir}"/>
|
---|
121 | <exec executable="perl" failonerror="true" output="${po.build.dir}/plugin_${dir}/trans_plugin.java">
|
---|
122 | <arg line="convplugins.pl ${plugin.dir}/${dir}/build.xml"/>
|
---|
123 | </exec>
|
---|
124 | <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">
|
---|
125 | <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
|
---|
126 | <fileset dir="${po.build.dir}/plugin_${dir}" includes="trans_*.java"/>
|
---|
127 | </gettext-extract>
|
---|
128 | <if>
|
---|
129 | <available file="${po.build.dir}/plugin_${dir}/josm.pot"/>
|
---|
130 | <then>
|
---|
131 | <copy todir="${po.build.dir}/plugin_${dir}">
|
---|
132 | <fileset dir="po"/>
|
---|
133 | </copy>
|
---|
134 | <gettext-merge keysFile="josm.pot" poDirectory="${po.build.dir}/plugin_${dir}"/>
|
---|
135 | <exec executable="perl" failonerror="true">
|
---|
136 | <arg line="i18n.pl ${plugin.dir}/${dir}/data/ ${po.build.dir}/plugin_${dir}/*.po"/>
|
---|
137 | </exec>
|
---|
138 | </then>
|
---|
139 | </if>
|
---|
140 | <delete dir="${po.build.dir}/plugin_${dir}"/>
|
---|
141 | </target>
|
---|
142 | <target name="clean">
|
---|
143 | <delete dir="${i18n.build.dir}"/>
|
---|
144 | <delete file="po/josm.pot"/>
|
---|
145 | <delete>
|
---|
146 | <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
|
---|
147 | </delete>
|
---|
148 | <delete>
|
---|
149 | <fileset dir="po" includes="*.po" defaultexcludes="false"/>
|
---|
150 | </delete>
|
---|
151 | </target>
|
---|
152 | <target name="test">
|
---|
153 | <mkdir dir="${i18n.build.dir}/test"/>
|
---|
154 | <exec executable="perl" failonerror="true">
|
---|
155 | <arg line="i18n.pl ${i18n.build.dir}/test/ po/*.po"/>
|
---|
156 | </exec>
|
---|
157 | </target>
|
---|
158 | <target name="pot" depends="po/josm.pot" />
|
---|
159 | <target name="transifex" depends="po/core.pot,po/plugins.pot,po/data.pot" />
|
---|
160 | <target name="update">
|
---|
161 | <exec executable="perl" failonerror="true">
|
---|
162 | <arg line="launchpad.pl bzronly"/>
|
---|
163 | </exec>
|
---|
164 | <antcall target="build"/>
|
---|
165 | </target>
|
---|
166 | <target name="updatecore">
|
---|
167 | <exec executable="perl" failonerror="true">
|
---|
168 | <arg line="launchpad.pl bzronly"/>
|
---|
169 | </exec>
|
---|
170 | <antcall target="buildcore"/>
|
---|
171 | </target>
|
---|
172 | </project>
|
---|