Friday, October 29, 2010

Multilingual Support for Flex

Some Cowboy coding techniques for supporting multilingual flex interfaces:
Instead of the usual form (from an Adobe development center post):
...text="{resourceManager.getString('resources', 'POSTDISPLAY_POST_TITLE')}"...
My label looks like:
...text="{gS['POSTDISPLAY_POST_TITLE']}"...
Which is so much shorter and nicer to read when you are coding.

The gS is actually a static object (i.e. hash map) that I load with all the key:value pairs of the language.
Once you declare gS as [Bindable] you can replace the object at runtime with other languages, resulting with the replacement of all the strings in the application.

Note: the compiler issues a warning that since you are using square brackets, the GUI object will not be able to detect changes in the data source. Well, it does.

Independent on Sundays




No comments:

Post a Comment

Please do not post spam on this blog, Spam sites will be reported to google.
thank you kindly.