I am looking into internationalizing a Flex application I am working on and I am curious if there are any best practices or recommendations for doing so.
Googling for such information results in a handful of small articles and blog posts, each about doing it differently, and the advantages and disadvantages are not exactly clear.
Edited to narrow scope:
- Need to support only two languages (en_CA and fr_CA)
- Need to be able to switch at runtime
Of course, after googling a bit more I come across an article on runtime localization.
And followed these steps:
Add the following to the compiler arguments to specify the supported locales and their path: (In Flex Builder, select project and go properties -> Flex Compiler -> Additional Compiler Arguments)
-locale=en_CA,fr_CA -source-path=locale/{locale}Create the following files:
And then the compiler complains:
unable to open 'C:\Program Files\Adobe\Flex Builder 3\sdks\3.1.0\frameworks\locale\en_CA'Which looks to be related to bug SDK-12507
Work around:
In the
sdks\3.1.0\bindirectory, execute the following commands:This will create the locale directories in the Flex Builder installation and build some required resources into them.
Then in your
.mxmlfiles, reference the resource bundle:And internationalize the strings:
becomes:
and
becomes:
And in your
src/locale/en_CA/resources.propertiesfile: