0ecd70260df790bb9233d569a5d81739c4e0df35
[potlatch2.git] / l10n / map / LocalizationMap.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <LocaleMap enableLog="true"
3     xmlns:mx="http://www.adobe.com/2006/mxml"
4     xmlns:factory="mx.core.*"
5     xmlns="library://ns.babelfx.org/l10n/flex/" >
6
7   <!-- Support for Locale ResourceBundle changes -->
8   <mx:Script>
9     <![CDATA[
10       import com.mindspace.l10n.commands.ExternalLocaleCommand;
11       import mx.resources.ResourceManager;
12       import mx.resources.IResourceManager;
13
14       import net.systemeD.potlatch2.help.HelpDialog;
15
16
17       private function onLocaleChanged(event:Event):void {
18           var rMngr : IResourceManager = ResourceManager.getInstance();
19           var sri : SmartResourceInjector = event.target as SmartResourceInjector;
20           var options : Array = [
21                                   { label : rMngr.getString('p2_main','main.gps_data') },
22                                   { label : rMngr.getString('p2_main','main.my_tracks') }
23                                 ];
24
25           // Iterate all view instances and inject new dataProvider
26           for each (var inst:potlatch2 in sri.targetInstances) {
27               if (inst == null) continue;
28               inst.gpsButton.dataProvider = options;
29           }
30       }
31     ]]>
32   </mx:Script>
33
34   <commandFactory>
35     <factory:ClassFactory generator="{ExternalLocaleCommand}">
36       <factory:properties>
37         <mx:Object externalPath="locales/\{0\}.swf"/>
38       </factory:properties>
39     </factory:ClassFactory>
40   </commandFactory>
41
42   <!--
43   SmartResourceInjectors for targeted class instantiations. Instead of dependency injection of UI instances,
44   we use SRI(s) here to remove any need to know view hierarchy relationships... we simply want a reference
45   to the UI instance when ready.
46   -->
47
48   <SmartResourceInjector bundleName="help_dialog" target="{HelpDialog}">
49     <ResourceProxy property="gettingStarted.text" key="help.gettingStarted" />
50     <ResourceProxy property="welcome.label" key="help.welcome" />
51   </SmartResourceInjector>
52
53   <SmartResourceInjector bundleName="p2_main" target="{potlatch2}" localeChange="onLocaleChanged(event)">
54     <ResourceProxy property="bgButton.label" key="main.background" />
55     <ResourceProxy property="styleButton.label" key="main.map_style" />
56     <ResourceProxy property="undo.label" key="main.undo" />
57     <ResourceProxy property="redo.label" key="main.redo" />
58     <ResourceProxy property="helpButton.label" key="main.help" />
59     <ResourceProxy property="optionsButton.label" key="main.options" />
60     <ResourceProxy property="saveButton.label" key="main.save" />
61   </SmartResourceInjector>
62
63 </LocaleMap>