Some places in my flex app, I use ResourceManager.getInstance().getString, and other places I use mxml @Resource tag to retrieve resource properties dynamically loaded from ResourceManager.
resourceManager.loadResourceModule(resourceModuleURL);
But only strings from ResourceManager.getInstance().getString show proper locale based values, while the @Resource tag only returns values from en_US resource. I guess it is because en_US is what I compiled with (-locale=en_US ).
So I am wondering if I am using a dynamicly-loaded resource, do I have to abandon the @Resource tag and use ResourceManager.getInstance().getString ?
Thanks.
When you compile, you need to include a list of comma-separated locales:
-locale=en_US,es_ESThat should allow @Resource to then be used for localization.
More detail in the help documentation:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f3a.html#WS2db454920e96a9e51e63e3d11c0bf6119c-7fef
Excerpt:
-locale=en_US,es_ESEDIT:
To separate the locales into separate SWF files, try creating Resource Modules. Here’s an excerpt:
They’re great to use for localization, as you can separate each language into different swf files.
Here’s a link explaining resource modules:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f3c.html
My recommendation is to create the Resource Modules you need to use as localization as SWFs, and then either compile them into the application at compile time, or dynamically lead each ResourceModule at run-time, so you have access to it.