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/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="trans_.java">
|
---|
24 | <mkdir dir="${i18n.build.dir}"/>
|
---|
25 | <exec executable="perl" failonerror="true" output="${i18n.build.dir}/trans_presets.java">
|
---|
26 | <arg line="convpreset.pl ${josm.presets}"/>
|
---|
27 | </exec>
|
---|
28 | <exec executable="perl" output="${i18n.build.dir}/trans_style.java">
|
---|
29 | <arg line="convstyle.pl ${josm.style}"/>
|
---|
30 | </exec>
|
---|
31 | <exec executable="perl" output="${i18n.build.dir}/trans_validator.java">
|
---|
32 | <arg line="convvalidator.pl ${validator.tagfile}"/>
|
---|
33 | </exec>
|
---|
34 | <exec executable="perl" output="${i18n.build.dir}/trans_wms.java">
|
---|
35 | <arg line="convwms.pl ${wms.srcfile}"/>
|
---|
36 | </exec>
|
---|
37 | <exec executable="perl" output="${i18n.build.dir}/trans_surveyor.java">
|
---|
38 | <arg line="convsurveyor.pl ${surveyor.srcfile}"/>
|
---|
39 | </exec>
|
---|
40 | <exec executable="perl" output="${i18n.build.dir}/trans_plugins.java">
|
---|
41 | <arg line="convplugins.pl ${plugin.dir}/*/build.xml"/>
|
---|
42 | </exec>
|
---|
43 | <copy file="specialmessages.java" todir="${i18n.build.dir}"/>
|
---|
44 | </target>
|
---|
45 | <target name="po/josm.pot" description="Extracts message keys from the source code" depends="trans_.java,init">
|
---|
46 | <gettext-extract keysFile="josm.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
|
---|
47 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
---|
48 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
---|
49 | <fileset dir="${i18n.build.dir}" includes="trans_*.java"/>
|
---|
50 | <fileset dir="${plugin.dir}" includes="**/*.java"/>
|
---|
51 | </gettext-extract>
|
---|
52 | </target>
|
---|
53 | <target name="build" depends="po/josm.pot,init">
|
---|
54 | <gettext-merge keysFile="josm.pot" poDirectory="po"/>
|
---|
55 | <antcall target="coretrans"/>
|
---|
56 | <foreach param="path" target="plugintrans">
|
---|
57 | <path>
|
---|
58 | <dirset dir="${plugin.dir}" includes="*"/>
|
---|
59 | </path>
|
---|
60 | </foreach>
|
---|
61 | </target>
|
---|
62 | <target name="buildcore" depends="po/josm.pot,init">
|
---|
63 | <gettext-merge keysFile="josm.pot" poDirectory="po"/>
|
---|
64 | <antcall target="coretrans"/>
|
---|
65 | </target>
|
---|
66 | <target name="coretrans">
|
---|
67 | <mkdir dir="${po.build.dir}/core"/>
|
---|
68 | <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">
|
---|
69 | <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
|
---|
70 | <fileset dir="${i18n.build.dir}" includes="specialmessages.java"/>
|
---|
71 | <fileset dir="${i18n.build.dir}" includes="trans_*.java"/>
|
---|
72 | </gettext-extract>
|
---|
73 | <copy todir="${po.build.dir}/core">
|
---|
74 | <fileset dir="po"/>
|
---|
75 | </copy>
|
---|
76 | <gettext-merge keysFile="josm.pot" poDirectory="${po.build.dir}/core"/>
|
---|
77 | <exec executable="perl">
|
---|
78 | <arg line="i18n.pl ${i18n.install.dir}/ ${po.build.dir}/core/*.po"/>
|
---|
79 | </exec>
|
---|
80 | </target>
|
---|
81 | <target name="plugintrans" depends="init">
|
---|
82 | <basename file="${path}" property="dir"/>
|
---|
83 | <mkdir dir="${po.build.dir}/plugin_${dir}"/>
|
---|
84 | <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">
|
---|
85 | <fileset dir="${plugin.dir}/${dir}" includes="**/*.java"/>
|
---|
86 | </gettext-extract>
|
---|
87 | <if>
|
---|
88 | <available file="${po.build.dir}/plugin_${dir}/josm.pot"/>
|
---|
89 | <then>
|
---|
90 | <copy todir="${po.build.dir}/plugin_${dir}">
|
---|
91 | <fileset dir="po"/>
|
---|
92 | </copy>
|
---|
93 | <gettext-merge keysFile="josm.pot" poDirectory="${po.build.dir}/plugin_${dir}"/>
|
---|
94 | <exec executable="perl">
|
---|
95 | <arg line="i18n.pl ${plugin.dir}/${dir}/data/ ${po.build.dir}/plugin_${dir}/*.po"/>
|
---|
96 | </exec>
|
---|
97 | </then>
|
---|
98 | </if>
|
---|
99 | <delete dir="${po.build.dir}/plugin_${dir}"/>
|
---|
100 | </target>
|
---|
101 | <target name="clean">
|
---|
102 | <delete dir="${i18n.build.dir}"/>
|
---|
103 | <delete file="po/josm.pot"/>
|
---|
104 | <delete>
|
---|
105 | <fileset dir="po" includes="*.*~" defaultexcludes="false"/>
|
---|
106 | </delete>
|
---|
107 | <delete>
|
---|
108 | <fileset dir="po" includes="*.po" defaultexcludes="false"/>
|
---|
109 | </delete>
|
---|
110 | </target>
|
---|
111 | <target name="test">
|
---|
112 | <mkdir dir="${i18n.build.dir}/test"/>
|
---|
113 | <exec executable="perl">
|
---|
114 | <arg line="i18n.pl ${i18n.build.dir}/test/ po/*.po"/>
|
---|
115 | </exec>
|
---|
116 | </target>
|
---|
117 | <target name="pot" depends="po/josm.pot" />
|
---|
118 | <target name="update">
|
---|
119 | <exec executable="perl">
|
---|
120 | <arg line="launchpad.pl bzronly"/>
|
---|
121 | </exec>
|
---|
122 | <antcall target="build"/>
|
---|
123 | </target>
|
---|
124 | <target name="updatecore">
|
---|
125 | <exec executable="perl">
|
---|
126 | <arg line="launchpad.pl bzronly"/>
|
---|
127 | </exec>
|
---|
128 | <antcall target="buildcore"/>
|
---|
129 | </target>
|
---|
130 | </project>
|
---|