Comments on: Building Multilanguage Flex RIAs http://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/ Patterns with Flex, RUX, and software Sun, 29 Aug 2010 13:46:08 +0000 http://wordpress.org/?v=abc hourly 1 By: thomasbhttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-488 thomasb Mon, 16 Aug 2010 18:02:24 +0000 http://www.gridlinked.info/?p=453#comment-488 @Mario,Make sure the resources are available (loaded) to the resourceManager; use resourceManager.getString(bundleName, key, null, locale) to check. If that standard call works, then l10nInjection should also work. Meanwhile, have you loaded the module as a child (with access rights to its parent code)? I recommend placing all shared resources in a bundle or RSL that is loaded by the main app. Then the modules, when loaded, can use the RSL code or the bundles resources. @Mario,

Make sure the resources are available (loaded) to the resourceManager; use resourceManager.getString(bundleName, key, null, locale) to check. If that standard call works, then l10nInjection should also work. Meanwhile, have you loaded the module as a child (with access rights to its parent code)? I recommend placing all shared resources in a bundle or RSL that is loaded by the main app. Then the modules, when loaded, can use the RSL code or the bundles resources.

]]>
By: thomasbhttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-487 thomasb Mon, 16 Aug 2010 17:55:52 +0000 http://www.gridlinked.info/?p=453#comment-487 @MarioS, Look at the the online sample "<a href="http://github.com/ThomasBurleson/l10nInjection_Samples/tree/master/Intranet/" rel="nofollow">Employee Intranet</a>"; which uses Mate MVC and l10nInjection. That application has two modules (Admin, Contacts), each module has its OWN LocalizationMap. For modules, any <mx:Module /> subclass can instantiate its own custom localization map; or you can use IoC to inject an instance upon demand. Be sure to separate resources shared to one map and module-specific resources to a locale map specific to that locale. Then you also probably want to load your resource bundles externally... so check out the <a href="http://wiki.github.com/ThomasBurleson/l10nInjection_Samples/sample-applications#demo2" rel="nofollow">Multilanguage FlexStore</a> to see how external bundles are loaded upon demand. @MarioS,
Look at the the online sample “Employee Intranet“; which uses Mate MVC and l10nInjection. That application has two modules (Admin, Contacts), each module has its OWN LocalizationMap. For modules, any <mx:Module /> subclass can instantiate its own custom localization map; or you can use IoC to inject an instance upon demand. Be sure to separate resources shared to one map and module-specific resources to a locale map specific to that locale. Then you also probably want to load your resource bundles externally… so check out the Multilanguage FlexStore to see how external bundles are loaded upon demand.

]]>
By: MarioShttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-486 MarioS Mon, 16 Aug 2010 15:46:16 +0000 http://www.gridlinked.info/?p=453#comment-486 I have implemented a small proof-of-concept but now I'm facing a new problem. I'm not sure if depends on the framework or not. The module for which I want to implement the internationlization makes use of a library which is used in different modules. This library contains also ressources files. In my module I can only refer to a key from the library resource file otherwise the label or whatever stays blank. Do you have any idea why it happens? I have implemented a small proof-of-concept but now I’m facing a new problem. I’m not sure if depends on the framework or not. The module for which I want to implement the internationlization makes use of a library which is used in different modules. This library contains also ressources files. In my module I can only refer to a key from the library resource file otherwise the label or whatever stays blank. Do you have any idea why it happens?

]]>
By: Marioshttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-485 Marios Mon, 16 Aug 2010 08:41:19 +0000 http://www.gridlinked.info/?p=453#comment-485 Hello Thomas,after reviewing your sample code it is quite obvious how it works. It is really a nice and clean solution. Is it possible to have 2 LocalizedMaps in one project? I ask because in our project we use a library which includes some views which are used in different modules. This library contains ressource files and the modules contein ressource files, too. From my point of view I would have to implement 1 LocalizedMap in the library and one in the module. I would like to implement a proof-of-concept but I cannot find the download for the .swc file. Hello Thomas,

after reviewing your sample code it is quite obvious how it works. It is really a nice and clean solution.
Is it possible to have 2 LocalizedMaps in one project? I ask because in our project we use a library which includes some views which are used in different modules. This library contains ressource files and the modules contein ressource files, too. From my point of view I would have to implement 1 LocalizedMap in the library and one in the module.
I would like to implement a proof-of-concept but I cannot find the download for the .swc file.

]]>
By: thomasbhttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-484 thomasb Wed, 11 Aug 2010 17:11:45 +0000 http://www.gridlinked.info/?p=453#comment-484 @MarioS, 1) The array you defined is a "model" used a dataProvider. But unfortunately your model does not support databinding, so any changes to that dataProvider will NOT be announced/dispatched to the comboBox. This problem exists regardless of l10nInjection changes. When the localized resources change, you must manually rebuild the dataProvider (with new localized values) and reassign the new dataProvider to the comboBox. In the LocalizationMap, you want to add custom method [in your script block] to manually rebuild the dataProvider. You can also use the SmartResourceInjector to get the instance(s) of the views that are parents to the comboBoxes. 2) Your controller class(es) manage Alerts and their contents... so the text resources in those Alerts should be in a "model". When the locale changes, you the values used by "future" alerts must be updated... the model data must be updated. Then your controller class(es) will use that model data. See again the link below for examples.Here is <a href="http://flash.gridlinked.info/samples/l10nInjection/cafeTownsend/v2c/srcview/index.html" rel="nofollow">online, sample code</a> at GitHub. Review the <strong>l10.map.LocalizationMap</strong>.mxml class. See the method <em>LocalizationMap::onLocaleChanged().</em> @MarioS,
1) The array you defined is a “model” used a dataProvider. But unfortunately your model does not support databinding, so any changes to that dataProvider will NOT be announced/dispatched to the comboBox. This problem exists regardless of l10nInjection changes.
When the localized resources change, you must manually rebuild the dataProvider (with new localized values) and reassign the new dataProvider to the comboBox. In the LocalizationMap, you want to add custom method [in your script block] to manually rebuild the dataProvider. You can also use the SmartResourceInjector to get the instance(s) of the views that are parents to the comboBoxes.
2) Your controller class(es) manage Alerts and their contents… so the text resources in those Alerts should be in a “model”. When the locale changes, you the values used by “future” alerts must be updated… the model data must be updated. Then your controller class(es) will use that model data. See again the link below for examples.

Here is online, sample code at GitHub. Review the l10.map.LocalizationMap.mxml class. See the method LocalizationMap::onLocaleChanged().

]]>
By: marioShttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-483 marioS Wed, 11 Aug 2010 10:59:12 +0000 http://www.gridlinked.info/?p=453#comment-483 I'm struggeling with the flex resourceManger and found your I10NInjection framework. After reading the posts and looking at example code I'm not sure if the framework solves the issues that I have with the resourceManager.1. I have some widgets e.g. comboboxes which are filled via a dataprovider like this: the dataprovider is initialised in the onApplicationComplete method of the viewcomboArray = [{label:resourceManager.getString('language', 'form.value1.label'), data:"test1"}, {label:resourceManager.getString('language', 'form.value2.label'), data:"test2"}];How could I inject data in this comboArray.2. We have our own controller AS classes in which Alerts are invoked. How can I inject data there? With the resourceManager it works fine.Regards,Mario I’m struggeling with the flex resourceManger and found your I10NInjection framework. After reading the posts and looking at example code I’m not sure if the framework solves the issues that I have with the resourceManager.

1. I have some widgets e.g. comboboxes which are filled via a dataprovider like this:

the dataprovider is initialised in the onApplicationComplete method of the view

comboArray = [{label:resourceManager.getString('language', 'form.value1.label'), data:"test1"},
{label:resourceManager.getString('language', 'form.value2.label'), data:"test2"}];

How could I inject data in this comboArray.

2. We have our own controller AS classes in which Alerts are invoked. How can I inject data there? With the resourceManager it works fine.

Regards,

Mario

]]>
By: thomasbhttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-459 thomasb Fri, 18 Jun 2010 18:32:03 +0000 http://www.gridlinked.info/?p=453#comment-459 @Hung, The tabNavigator has a creation policy of Auto; which means the Department contents are not created until that tab is selected for the first time. Thus injection will fail since the tab contents do not yet exist. Meanwhile the tab label actually uses the "label" value of the content [Canvas] to set the text... but if the content creation is deferred, then the compiler uses the original "compiled" value (which is en_US "Departments". Now when the viewStack children are instantiated, l10nInjection modifies the "label" property of each child. That changes triggers an "labelChanged" property change event which forces the TabBar to update its tabs with the new localized strings.The l10nInjection is working properly. But the application code has not coded to handle this rare case of deferred children and localized labels within data-driven TabBars. We have a supported list of <a href="http://github.com/ThomasBurleson/l10n_Injection/issues/#list" rel="nofollow">Feature requests and Issues</a> logged in GitHub. Feel free to add to that list. @Hung,
The tabNavigator has a creation policy of Auto; which means the Department contents are not created until that tab is selected for the first time. Thus injection will fail since the tab contents do not yet exist.
Meanwhile the tab label actually uses the “label” value of the content [Canvas] to set the text… but if the content creation is deferred, then the compiler uses the original “compiled” value (which is en_US “Departments”. Now when the viewStack children are instantiated, l10nInjection modifies the “label” property of each child. That changes triggers an “labelChanged” property change event which forces the TabBar to update its tabs with the new localized strings.

The l10nInjection is working properly. But the application code has not coded to handle this rare case of deferred children and localized labels within data-driven TabBars. We have a supported list of Feature requests and Issues logged in GitHub. Feel free to add to that list.

]]>
By: Hung Tranhttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-458 Hung Tran Fri, 18 Jun 2010 18:06:34 +0000 http://www.gridlinked.info/?p=453#comment-458 Hi Thomas,I tried the viewState and if you change the language without change the 'Department' tab on the second tabnavigator first, then there is no injection on this tab. The tab will show the old title 'Department'. I guest this container is not ready so that the injection may not occur. Would you please take a lookthanks Good work.:) Hi Thomas,

I tried the viewState and if you change the language without change the ‘Department’ tab on the second tabnavigator first, then there is no injection on this tab. The tab will show the old title ‘Department’. I guest this container is not ready so that the injection may not occur. Would you please take a look

thanks
Good work.:)

]]>
By: thomasbhttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-457 thomasb Fri, 18 Jun 2010 12:44:02 +0000 http://www.gridlinked.info/?p=453#comment-457 @Bazu, [Inject] is a Swiz metatadata tag true... that auto-injects an instance reference into the LocalizationMap. If you are using Mate, Cairngorm or your own framework you must decide how you will assign references to model variables in your custom LocalizationMap. That solution is completely separate from l10nInjection.You use EventMap(s) in Mate to listen for events, fire actions, and update models. You use a LocalizationMap to inject localized resources into GUI and non-GUI targets. You could use a LocalizationMap tag inside the EventMap and then assign model references to property variables in the LocalizationMap... but the specifics are up to you. Just realize that EventMaps and LocalizatioMaps are two separate solutions. @Bazu,
[Inject] is a Swiz metatadata tag true… that auto-injects an instance reference into the LocalizationMap. If you are using Mate, Cairngorm or your own framework you must decide how you will assign references to model variables in your custom LocalizationMap. That solution is completely separate from l10nInjection.

You use EventMap(s) in Mate to listen for events, fire actions, and update models. You use a LocalizationMap to inject localized resources into GUI and non-GUI targets. You could use a LocalizationMap tag inside the EventMap and then assign model references to property variables in the LocalizationMap… but the specifics are up to you. Just realize that EventMaps and LocalizatioMaps are two separate solutions.

]]>
By: bazuhttp://www.gridlinked.info/amazing-i18n-solutions-for-flex-3-4/#comment-456 bazu Fri, 18 Jun 2010 09:56:26 +0000 http://www.gridlinked.info/?p=453#comment-456 You're really fast :)Thanks for your reply, that answear my question but raise a new question. Please forgive my poor skills and knowledge but I'm I right when I assume that this [Inject] metadata Tag is only available in Swiz and RobotLegs?So in mate I need to use an EventMap for Localization to inject the selectedEmployee? You’re really fast :)

Thanks for your reply, that answear my question but raise a new question.
Please forgive my poor skills and knowledge but I’m I right when I assume that this [Inject] metadata Tag is only available in Swiz and RobotLegs?

So in mate I need to use an EventMap for Localization to inject the selectedEmployee?

]]>