Add build step for deploying translations.

This commit is contained in:
Jelle van der Waa 2016-06-09 12:03:55 +02:00
parent f0a863f3e0
commit ed708a24c3

View File

@ -4,6 +4,7 @@
<property name="tools-folder" value="${root-folder}/tools/"/>
<property name="target-folder" value="${root-folder}/deploy/plugins"/>
<property name="server-folder" value="${root-folder}/server"/>
<property name="language-folder" value="${basedir}/language"/>
<import file="${tools-folder}/antutil.xml"/>
@ -156,8 +157,47 @@
</exec>
</target>
<!-- Generate language files -->
<target name="language">
<if>
<available file="msgfmt" filepath="${env.PATH}" />
<then>
<foreach target="msgfmt" param="file">
<path>
<fileset dir="${language-folder}">
<include name="**/LC_MESSAGES/*.po"/>
</fileset>
</path>
</foreach>
</then>
<else>
<echo message="WARNING: msgfmt not available, not generating *.mo files for translations"/>
<!-- just copy files -->
<copy todir="${target-folder}/${plugin-folder}">
<fileset dir=".">
<include name="language/**/*.mo"/>
<include name="language/**/*.txt"/>
</fileset>
</copy>
</else>
</if>
</target>
<target name="msgfmt">
<propertyregex property="outfile" input="${file}" regexp=".*\/(language\/.*)\.po" replace="${target-folder}/${plugin-folder}/\1\.mo"/>
<echo message="Converting ${file} to ${outfile}"/>
<dirname property="outdir" file="${outfile}"/>
<mkdir dir="${outdir}"/>
<exec executable="msgfmt" failonerror="true" logError="true">
<arg value="-v"/>
<arg value="-o"/>
<arg value="${outfile}"/>
<arg value="${file}"/>
</exec>
</target>
<!-- Install all files into the target folder -->
<target name="deploy" depends="compress, validate">
<target name="deploy" depends="compress, validate, language">
<mkdir dir="${target-folder}/${plugin-folder}"/>
<!-- Copy (and validate) manifest.xml -->