4 Replies Latest reply on Dec 1, 2009 8:54 AM by acoquinar

    localeChain=[fr_FR] doesn't translate every menu items !!!

    acoquinar

      For some reason, when i change the locale to french, the top menu items don't get changed to the new values but all the subitems are. (Even if they are present in my resource bundle.)

       

      If i start the application by specifying the other language in the app's init function, then the entire menu displays the french menu items.

       

      I feel like it is a UI refreshing problem !.. (I don't think there is any flex refresh function !)

       

      Here is the code:

       

      <?xml version="1.0" encoding="utf-8"?>

       


      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:components="components.*" >
          <mx:Script>
              <![CDATA[
                  import mx.events.MenuEvent;
                  import utilities.ResourceUtility;
                  import mx.resources.ResourceBundle;
                  import mx.controls.Alert;

                             
                  private function menuClickHandler(event:MenuEvent):void
                  {
         
                      var menuItem:XML = event.item as XML;
                 
                      switch (menuItem.@view.toString())
                      {
                          case "tools":
                         
                              break;
                          case "english":
                              resourceManager.localeChain = ['en_US'];
                              break;
                          case "french":
                              resourceManager.localeChain = ['fr_FR'];
                              break;
                          default:
                              break;
                      }
                     
                     
                  }
                 
                 
                 
                 
                 
              ]]>
          </mx:Script>
          <mx:MenuBar id="myMenuBar" labelField="@label" height="20" x="0" y="0" itemClick="menuClickHandler(event)">
        
              <mx:XMLList>
             
                  <menuitem  label="{resourceManager.getString('myResources', 'TOOLS')}" view="tools">
                      <menuitem label="Options"/>
                      <menuitem label="{resourceManager.getString('myResources', 'LANGUAGE')}" view="language">
                          <menuitem  label="{resourceManager.getString('myResources', 'FRENCH')}"  view="french" type="check" toggled="{frToggled}"/>
                          <menuitem  label="{resourceManager.getString('myResources', 'ENGLISH')}" view="english" type="check" toggled="{enToggled}"/>
                       </menuitem>
                  </menuitem>
                  <menuitem label="{resourceManager.getString('myResources', 'HELP')}" view="help">
                      <menuitem label="{resourceManager.getString('myResources', 'ABOUT_RS')}" view="about"/>
                  </menuitem>
              </mx:XMLList>
          </mx:MenuBar>
         
          <mx:ViewStack id="mainWorkStack" width="100%" height="100%" x="0" y="20" >
              <components:introView id="introView" width="100%" height="100%"/>
              <components:systemMainView id="systemMainView" width="100%" height="100%"/>   
              <components:nasMainView id="nasMainView" width="100%" height="100%"/>   
             
             
          </mx:ViewStack>
      </mx:Canvas>