0
votes

I have a few different tabs in a navigator defined like this : (removed client specific domain)

<s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009" 
                    xmlns:s="library://ns.adobe.com/flex/spark" 
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:container="com.*****.shop.admin.container.*"
                    width="100%" height="100%"
                    implements="com.*****.common.container.IScreen"
                    xmlns:services="com.****.shop.admin.services.*"
                    label="Service Types">

I have resource bundles for different locales, en_US looks like this :

ServicesScreen.label=Service Types

When I try to do this, it doesn't work :

...    
... 
label="{resourceManager.getString('resources','ServicesScreen.label')}"

Instead of getting my resource bundle entry, I get something weird looking in my GUI like :

Shop0.ShopSkin9._ShopSkin_Group1.contentScroller.ScrollerSkin13.contentGroup.vsMain.AdminView154.SkinnableContainerSkin159.contentGroup.subNavItems.opCodeScreen

My resource bundles work in other cases, for instance labels next to form input fields, etc... The code compiles, however, and no errors are actually thrown (compile or run-time). I tried assigning the value to a variable and using that variable in the label field, however that caused a compile error.

I tried calling a setter method on creation complete of the component, but that didn't resolve the issue either.

How do I localize my tab labels, and can I do so dynamically at run-time?

Thanks for your time!

1
I don't see anything wrong with your code, so the only think I can come up with is that maybe resources is some kind of reserved word you can't use for resource bundle names. I had mystery-bug of my own once by naming my bundle components, which conflicted with a bundle of the same name that exists in the SDK.RIAstar
I will try to change it, however my bundle works for all of the other entries, like images, text input labels, etc, while using the bundle named resources.properties. It's really only when it comes to properties defined in the views' "constructors" so to speakuser1735181
Go back to using your approach with the setter method. Then step through the code with the debugger. If you step into the resourceManager.getString() method you should see what is happening.Sunil D.

1 Answers

0
votes

I guess I'll self-answer this one, although credit goes to Sunil D. I don't know why it didn't work earlier while I was testing, I must've missed something the first time, but here goes. first I added:

creationComplete="init(event)">

And then in that method body I did :

    protected function init(event:FlexEvent):void
    {
        this.label = resourceManager.getString('resources','opCodeScreen.title');
    }

And it works like a charm. honestly I'm pretty sure I did this exact same test this morning, but I guess not. Sunil If you want to make your comment an answer I'll go ahead and accept it.

EDIT: change the text at run-time, add currentStateChange that calls aforementionned method

Cheers!