Permalink
Browse files

Iterate over the locales rather than having to hardcode them. Thanks …

…to Hiroshi Miura!
  • Loading branch information...
gravitystorm committed Nov 26, 2011
1 parent 08c2015 commit cd73dd2a7e82df56e9144d4eeb42255b41608f73
Showing with 41 additions and 15 deletions.
  1. +1 −1 build.properties.template
  2. +40 −14 build.xml
  3. BIN lib/ant-contrib-1.0b3.jar
@@ -19,4 +19,4 @@ test.src.dir = ${basedir}/tests/src
test.fakeroot.dir = ${basedir}/tests/fakeroot
test.bin.dir = ${basedir}/tests/bin
report.dir = ${basedir}/tests/report
-report.html.dir = ${basedir}/tests/report/html
+report.html.dir = ${basedir}/tests/report/html
View
@@ -1,4 +1,4 @@
-<project name="Potlatch 2" default="debug">
+<project name="Potlatch 2" default="debug" xmlns:ac="antlib:net.sf.antcontrib">
<!-- load properties from the environment -->
<property environment="env" />
@@ -9,6 +9,9 @@
<!-- flexTasks comes with flex, but apparently it's good practice to put in the libs folder -->
<taskdef resource="flexTasks.tasks" classpath="${basedir}/lib/flexTasks.jar"/>
+ <!-- ant-contrib to build multiple locales -->
+ <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpath="${basedir}/lib/ant-contrib-1.0b3.jar"/>
+
<!-- if you are running git-svn, you need to run "git tag -a 0.4 0ac0de" where 0ac0de corresponds to the commitid of
potlatch2 v0.4 . You need to do this for each point release while we're still in SVN.
If you don't, then expect "git describe" to fail miserably.
@@ -58,7 +61,7 @@
</target>
<!-- note that there's an asdoc target in Flex 4, if/when we move to that -->
- <target name="docs" depends="manifests">
+ <target name="docs" depends="manifests,makeLocalesList">
<exec executable="${ASDOC}" failonerror="true">
<arg line="-source-path ."/>
<arg line="-doc-sources net/systemeD/"/>
@@ -89,6 +92,8 @@
<arg line="-package net.systemeD.potlatch2.utils 'Data loading utilities'" />
<arg line="-left-frameset-width 300" />
+ <arg line="-locale=${locales.list}" />
+ <arg line="-allow-source-path-overlap true" />
</exec>
</target>
@@ -257,23 +262,44 @@
</sequential>
</macrodef>
- <target name="buildLocales">
- <echo>Building Localization .swf's</echo>
- <compileLocale locale="en_US" />
- <compileLocale locale="en_GB" />
- <compileLocale locale="fr_FR" />
- <compileLocale locale="de_DE" />
- <compileLocale locale="pl_PL" />
+ <target name="makeLocalesList">
+ <ac:for param="dirname">
+ <path>
+ <dirset dir="${basedir}/l10n/locale/">
+ <exclude name="bundles"/>
+ <include name="??_??"/>
+ </dirset>
+ </path>
+ <sequential>
+ <ac:var name="localename" unset="true"/>
+ <basename property="localename" file="@{dirname}" />
+ <script language="javascript"><![CDATA[
+ if ((l = project.getProperty("locales.list")) != null) {
+ project.setUserProperty("locales.list", l+ "," +project.getProperty("localename"));
+ } else {
+ project.setUserProperty("locales.list", project.getProperty("localename"));
+ }
+ ]]></script>
+ </sequential>
+ </ac:for>
</target>
+ <target name="buildLocales" depends="makeLocalesList">
+ <echo>Building Localization .swf's</echo>
+ <ac:for list="${locales.list}" keepgoing="true" param="localename">
+ <sequential>
+ <compileLocale locale="@{localename}" />
+ </sequential>
+ </ac:for>
+ </target>
<target name="deployLocales" depends="buildLocales">
<echo>Deploying the compiled swf and assets package for the given locales</echo>
- <deployLocale locale="en_US" />
- <deployLocale locale="en_GB" />
- <deployLocale locale="fr_FR" />
- <deployLocale locale="de_DE" />
- <deployLocale locale="pl_PL" />
+ <ac:for list="${locales.list}" keepgoing="true" param="localename">
+ <sequential>
+ <deployLocale locale="@{localename}" />
+ </sequential>
+ </ac:for>
</target>
View
Binary file not shown.

0 comments on commit cd73dd2

Please sign in to comment.