Announcement Announcement Module
Collapse
No announcement yet.
Force re-evaluation of resource strings? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Force re-evaluation of resource strings?

    Hi,

    I have to load an extra resource bundle in a module that gets loaded by my application. I added the following code in the module's preinitialize:
    Code:
    private function module_preinitializeHandler( event:FlexEvent ):void
    {
        var resourceBundleInfo:ResourceBundleInfo = new ResourceBundleInfo( "bundles/custom/moduleresources.properties", "moduleresources", "custom" );
        var operation:LoadResourceBundleOperation = new LoadResourceBundleOperation( resourceBundleInfo );
        operation.addCompleteListener( function( event:OperationEvent ):void
                                       {
                                        // Force re-evaluation of the texts now that the custom language is loaded
                                        var localeChain:Array = ResourceManager.getInstance().localeChain;
                                        ResourceManager.getInstance().localeChain = [];
                                        ResourceManager.getInstance().localeChain = localeChain;
                                       } );
        operation.addErrorListener( function( event:OperationEvent ):void
                                    {
                                        Alert.show( "error loading resources: " + event.error );
                                    } );
    }
    The bundle gets loaded correctly, but I have to do a kind of trick with the localeChain to force a re-evaluation so I see the updated translations. Is there a better way to force re-evaluation of the translations?

    regards,

    Wim
    Last edited by fester; Feb 4th, 2011, 05:15 AM. Reason: event arguments had wrong types

  • #2
    A better solution seems to be:

    Code:
    ResourceManager.getInstance().update();
    See http://help.adobe.com/en_US/FlashPla...r.html#update() for more info.

    Comment

    Working...
    X