Flex Localised Resource Bundle Compiler

The Flex compiler moaning Unable to resolve resource bundle “xxx” for locale “yy_ZZ” sound familiar?

If you’re lucky you get away with running copylocale, but i always stumble upon nastier stuff (most projects for Belgian clients are bi-lingual… erm… bi-local French/Dutch).

To solve this for once and for all i wanted to create an elegant ANT scripty that takes care of all my localisation woes… Something easy, as it should be (c).
Thus i embarked on a (somewhat boring i must admit) adventure and started from the article “Easily compile resource bundles using Ant” which i improved a little here and there (uses compc.jar and not flexTasks, dynamically composes the -include-resource-bundles argument etc…) and did get some gratification i’d like to share.

Thou can download the project here.

- edit build.xml and change the FLEX_HOME property if needed
- that’s it… the rest is automagically done for you… no locales or bundles to specify…


Explode existing resource bundles
- place .swc files under /src/main/resources/locale/{locale}/..
- run ANT build script, target “explode-overwrite”

Compile resource bundles to swc or swf
- place .properties files under /src/main/locale/{locale}/{bundle}/..
- run ANT build script, target “compile-swc” (default) or target “compile-swf” (for runtime resource loading)

- copy the SDK compiled resource bundles under /src/main/resources/locale/en_US
- run the “explore-overwrite” target
- adapt the files under /src/main/locale/en_US to your liking + rename the en_US folder to your locale
- run the “compile-swc” target

Et voilĂ ! Happy multilingual times verdekke nondedju.

About this entry