Ticket #8645: 8645_build.patch

File 8645_build.patch, 6.1 KB (added by simon04, 6 years ago)
  • i18n/.tx/config

    diff --git a/i18n/.tx/config b/i18n/.tx/config
    index d7146be..3695b70 100644
    a b  
    22host = https://www.transifex.com
    33
    44[josm.core]
    5 file_filter = po/<lang>.po
     5file_filter = po/<lang>/core.po
    66source_file = po/core.pot
    77source_lang = en
    88type = PO
    99
    1010[josm.data]
    11 file_filter = po/<lang>.po
     11file_filter = po/<lang>/data.po
    1212source_file = po/data.pot
    1313source_lang = en
    1414type = PO
    1515
    1616[josm.plugins]
    17 file_filter = po/<lang>.po
     17file_filter = po/<lang>/plugins.po
    1818source_file = po/plugins.pot
    1919source_lang = en
    2020type = PO
  • i18n/build.xml

    diff --git a/i18n/build.xml b/i18n/build.xml
    index 48200c7..f3c4c3f 100644
    a b  
    11<?xml version="1.0" encoding="utf-8"?>
    22<project name="JOSM i18n" default="build" basedir=".">
    33    <!-- compilation properties -->
     4    <property name="languages" value="bg,ca,cs,da,de,el,en_AU,en_GB,es,et,eu,fi,fr,gl,hu,id,it,ja,nb,nl,pl,pt,pt_BR,ru,sk,sv,tr,uk,zh_CN,zh_TW"/>
     5    <property name="transifex.bin" value="tx"/>
    46    <property name="josm.build.dir" value="../core"/>
    57    <property name="josm.presets" value="${josm.build.dir}/data/defaultpresets.xml"/>
    68    <property name="josm.style" value="${josm.build.dir}/styles/standard/elemstyles.xml"/>
     
    4446        </exec>
    4547        <copy file="specialmessages.java" todir="${i18n.build.dir}"/>
    4648    </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>
    5649    <target name="po/core.pot" description="Extracts message keys from the JOSM core source code" depends="builddir,init">
    5750        <gettext-extract keysFile="core.pot" poDirectory="po" keywords="-k -ktrc:1c,2 -kmarktrc:1c,2 -ktr -kmarktr -ktrn:1,2 -ktrnc:1c,2,3">
    5851            <fileset dir="${josm.build.dir}/src" includes="**/*.java"/>
     
    7972            <arg line="--unique po/core.pot ${i18n.build.dir}/core.2.pot ${i18n.build.dir}/plugins.raw.pot"/>
    8073        </exec>
    8174    </target>
    82     <target name="build" depends="po/josm.pot,init">
     75    <target name="build" depends="init">
    8376        <gettext-merge keysFile="josm.pot" poDirectory="po"/>
    8477        <antcall target="coretrans"/>
    8578        <foreach param="path" target="plugintrans">
     
    8881            </path>
    8982        </foreach>
    9083    </target>
    91     <target name="singleplugintrans" depends="po/josm.pot,init">
     84    <target name="singleplugintrans" depends="init">
    9285        <antcall target="plugintrans">
    9386            <param name="path" value="${plugin}"/>
    9487        </antcall>
    9588    </target>
    96     <target name="buildcore" depends="po/josm.pot,init">
    97         <gettext-merge keysFile="josm.pot" poDirectory="po"/>
     89    <target name="buildcore" depends="init">
    9890        <antcall target="coretrans"/>
    9991    </target>
    10092    <target name="coretrans">
     
    10698            <fileset dir="${josm.build.dir}/data/validator" includes="*.mapcss"/>
    10799        </gettext-extract>
    108100        <copy todir="${po.build.dir}/core">
    109             <fileset dir="po"/>
     101            <fileset dir="po" includes="*.po"/>
    110102        </copy>
    111103        <gettext-merge keysFile="josm.pot" poDirectory="${po.build.dir}/core"/>
    112104        <exec executable="perl">
     
    127119            <available file="${po.build.dir}/plugin_${dir}/josm.pot"/>
    128120            <then>
    129121                <copy todir="${po.build.dir}/plugin_${dir}">
    130                     <fileset dir="po"/>
     122                    <fileset dir="po" includes="*.po"/>
    131123                </copy>
    132124                <gettext-merge keysFile="josm.pot" poDirectory="${po.build.dir}/plugin_${dir}"/>
    133125                <exec executable="perl">
     
    139131    </target>
    140132    <target name="clean">
    141133        <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>
     134        <delete dir="po"/>
     135        <mkdir dir="po"/>
    149136    </target>
    150137    <target name="test">
    151138        <mkdir dir="${i18n.build.dir}/test"/>
     
    153140            <arg line="i18n.pl ${i18n.build.dir}/test/ po/*.po"/>
    154141        </exec>
    155142    </target>
    156     <target name="pot" depends="po/josm.pot" />
     143    <target name="pot" depends="transifex" />
    157144    <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"/>
     145    <target name="fetch-po" depends="init">
     146        <exec executable="${transifex.bin}">
     147            <arg line="pull"/>
     148            <arg line="--language=${languages}"/>
    161149        </exec>
     150        <foreach param="path" target="concatenate-po">
     151            <path>
     152                <dirset dir="po" includes="*"/>
     153            </path>
     154        </foreach>
     155    </target>
     156    <target name="concatenate-po">
     157        <basename file="${path}" property="lang"/>
     158        <echo message="Combining ${lang} language files"/>
     159        <exec executable="msgcat">
     160            <arg line="${path}/core.po"/>
     161            <arg line="${path}/data.po"/>
     162            <arg line="${path}/plugins.po"/>
     163            <arg line="--output-file=po/${lang}.po"/>
     164        </exec>
     165    </target>
     166    <target name="update" depends="fetch-po">
    162167        <antcall target="build"/>       
    163168    </target>
    164     <target name="updatecore">
    165         <exec executable="perl">
    166             <arg line="launchpad.pl bzronly"/>
    167         </exec>
     169    <target name="updatecore" depends="fetch-po">
    168170        <antcall target="buildcore"/>       
    169171    </target>
    170172</project>