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" output="${i18n.build.dir}/trans_validator.java">
|
---|
34 | <arg line="convvalidator.pl ${validator.tagfile}"/>
|
---|
35 | </exec>
|
---|
36 | <exec executable="perl" output="${i18n.build.dir}/trans_wms.java">
|
---|
37 | <arg line="convwms.pl ${wms.srcfile}"/>
|
---|
38 | </exec>
|
---|
39 | <exec executable="perl" output="${i18n.build.dir}/trans_surveyor.java">
|
---|
40 | <arg line="convsurveyor.pl ${surveyor.srcfile}"/>
|
---|
41 | </exec>
|
---|
42 | <exec executable="perl" 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="${plugin.dir}" includes="**/*.java"/>
|
---|
54 | </gettext-extract>
|
---|
55 | </target>
|
---|
56 | <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="builddir,init">
|
---|
57 | <gettext-extract keysFile="core.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
58 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
---|
59 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
---|
60 | </gettext-extract>
|
---|
61 | </target>
|
---|
62 | <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">
|
---|
63 | <copy file="po/core.pot" tofile="${i18n.build.dir}/core.2.pot"/>
|
---|
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,${i18n.build.dir}/core.2.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_*.java"/>
|
---|
68 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
---|
69 | </gettext-extract>
|
---|
70 | <exec executable="msgcomm" output="po/data.pot">
|
---|
71 | <arg line="--unique po/core.pot ${i18n.build.dir}/core.2.pot ${i18n.build.dir}/data.raw.pot"/>
|
---|
72 | </exec>
|
---|
73 | </target>
|
---|
74 | <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">
|
---|
75 | <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">
|
---|
76 | <fileset dir="${plugin.dir}" includes="**/*.java"/>
|
---|
77 | </gettext-extract>
|
---|
78 | <exec executable="msgcomm" output="po/plugins.pot">
|
---|
79 | <arg line="--unique po/core.pot ${i18n.build.dir}/core.2.pot ${i18n.build.dir}/plugins.raw.pot"/>
|
---|
80 | </exec>
|
---|
81 | </target>
|
---|
82 | <target name="build" depends="po/josm.pot,init">
|
---|
83 | <gettext-merge keysFile="josm.pot" poDirectory="po"/>
|
---|
84 | <antcall target="coretrans"/>
|
---|
85 | <foreach param="path" target="plugintrans">
|
---|
86 | <path>
|
---|
87 | <dirset dir="${plugin.dir}" includes="*"/>
|
---|
88 | </path>
|
---|
89 | </foreach>
|
---|
90 | </target>
|
---|
91 | <target name="singleplugintrans" depends="po/josm.pot,init">
|
---|
92 | <antcall target="plugintrans">
|
---|
93 | <param name="path" value="${plugin}"/>
|
---|
94 | </antcall>
|
---|
95 | </target>
|
---|
96 | <target name="buildcore" depends="po/josm.pot,init">
|
---|
97 | <gettext-merge keysFile="josm.pot" poDirectory="po"/>
|
---|
98 | <antcall target="coretrans"/>
|
---|
99 | </target>
|
---|
100 | <target name="coretrans">
|
---|
101 | <mkdir dir="${po.build.dir}/core"/>
|
---|
102 | <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">
|
---|
103 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
---|
104 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
---|
105 | <fileset dir="${i18n.build.dir}" includes="trans_*.java"/>
|
---|
106 | <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
|
---|
107 | </gettext-extract>
|
---|
108 | <copy todir="${po.build.dir}/core">
|
---|
109 | <fileset dir="po"/>
|
---|
110 | </copy>
|
---|
111 | <gettext-merge keysFile="josm.pot" poDirectory="${po.build.dir}/core"/>
|
---|
112 | <exec executable="perl">
|
---|
113 | <arg line="i18n.pl ${i18n.install.dir}/ ${po.build.dir}/core/*.po"/>
|
---|
114 | </exec>
|
---|
115 | </target>
|
---|
116 | <target name="plugintrans" depends="init">
|
---|
117 | <basename file="${path}" property="dir"/>
|
---|
118 | <mkdir dir="${po.build.dir}/plugin_${dir}"/>
|
---|
119 | <exec executable="perl" output="${po.build.dir}/plugin_${dir}/trans_plugin.java">
|
---|
120 | <arg line="convplugins.pl ${plugin.dir}/${dir}/build.xml"/>
|
---|
121 | </exec>
|
---|
122 | <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">
|
---|
123 | <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
|
---|
124 | <fileset dir="${po.build.dir}/plugin_${dir}" includes="trans_*.java"/>
|
---|
125 | </gettext-extract>
|
---|
126 | <if>
|
---|
127 | <available file="${po.build.dir}/plugin_${dir}/josm.pot"/>
|
---|
128 | <then>
|
---|
129 | <copy todir="${po.build.dir}/plugin_${dir}">
|
---|
130 | <fileset dir="po"/>
|
---|
131 | </copy>
|
---|
132 | <gettext-merge keysFile="josm.pot" poDirectory="${po.build.dir}/plugin_${dir}"/>
|
---|
133 | <exec executable="perl">
|
---|
134 | <arg line="i18n.pl ${plugin.dir}/${dir}/data/ ${po.build.dir}/plugin_${dir}/*.po"/>
|
---|
135 | </exec>
|
---|
136 | </then>
|
---|
137 | </if>
|
---|
138 | <delete dir="${po.build.dir}/plugin_${dir}"/>
|
---|
139 | </target>
|
---|
140 | <target name="clean">
|
---|
141 | <delete dir="${i18n.build.dir}"/>
|
---|
142 | <delete file="po/josm.pot"/>
|
---|
143 | <delete>
|
---|
144 | <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
|
---|
145 | </delete>
|
---|
146 | <delete>
|
---|
147 | <fileset dir="po" includes="*.po" defaultexcludes="false"/>
|
---|
148 | </delete>
|
---|
149 | </target>
|
---|
150 | <target name="test">
|
---|
151 | <mkdir dir="${i18n.build.dir}/test"/>
|
---|
152 | <exec executable="perl">
|
---|
153 | <arg line="i18n.pl ${i18n.build.dir}/test/ po/*.po"/>
|
---|
154 | </exec>
|
---|
155 | </target>
|
---|
156 | <target name="pot" depends="po/josm.pot" />
|
---|
157 | <target name="transifex" depends="po/core.pot,po/plugins.pot,po/data.pot" />
|
---|
158 | <target name="update">
|
---|
159 | <exec executable="perl">
|
---|
160 | <arg line="launchpad.pl bzronly"/>
|
---|
161 | </exec>
|
---|
162 | <antcall target="build"/>
|
---|
163 | </target>
|
---|
164 | <target name="updatecore">
|
---|
165 | <exec executable="perl">
|
---|
166 | <arg line="launchpad.pl bzronly"/>
|
---|
167 | </exec>
|
---|
168 | <antcall target="buildcore"/>
|
---|
169 | </target>
|
---|
170 | </project>
|
---|