Thanks. It's not a matter of urgency. I could also imagine passing a globalSettings.localeChanged flag to buildTitle. It might be a nice addition to add a getStringWithSubstitution to ResourceManager, that took a ..rest parameter and called StringUtil.substitute() on the retrieved string.
On Fri, Jun 20, 2008 at 3:16 PM, Gordon Smith <[EMAIL PROTECTED]> wrote: > In that case, I don't think the binding expression will re-evaluate when the > localeChain changes. It may be easiest to override resourcesChanged(). But > you could also try doing some extra work to get the binding expression to > re-evaluate. Try putting [Bindable("change")] metadata on your declaration > of the buildTitle() method, and arrange for the class buildTitle() is in to > redispatch the ResourceManager's "change" events. > > > > Gordon Smith > > Adobe Flex SDK Team > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Richard Rodseth > Sent: Friday, June 20, 2008 3:03 PM > To: flexcoders@yahoogroups.com > Subject: Re: [flexcoders] internationalization @ switching runtime > > > > No, no, I am definitely using the ResourceManager. But the expression > is something like > > text="{buildTitle(someParameter)}" > > And buildTitle calls static function getUIString which calls > getResourceManager followed by some string substitution. > > On Fri, Jun 20, 2008 at 2:59 PM, Gordon Smith <[EMAIL PROTECTED]> wrote: >> If you're not using MXML databinding to write code like >> >> >> >> <Button id="b" label="{resourceManager.getString(...)}"/> >> >> >> >> then you can override the resourcesChanged() method and reassign the new >> string, as in >> >> >> >> b.label = resourceManager.getString(...); >> >> >> >> The ResourceManager works with resources in ResourceBundles, which >> normally >> get compiled from .properties files. Are you loading .properties files at >> runtime and parsing them yourself to get keys and values? In that case, >> you >> can create new instances of ResourceBundle at runtime, put your resources >> into them, and install them into the ResourceManager like this: >> >> >> >> var rb:ResourceBundle = new ResourceBundle(locale, bundleName); >> >> rb.content[key1] = value1; >> >> rb.content[key2] = value2; >> >> ... >> >> resourceManager.addResourceBundle(rb); >> >> >> >> Gordon Smith >> >> Adobe Flex SDK Team >> >> >> >> ________________________________ >> >> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On >> Behalf Of Richard Rodseth >> Sent: Friday, June 20, 2008 2:37 PM >> To: flexcoders@yahoogroups.com >> Subject: Re: [flexcoders] internationalization @ switching runtime >> >> >> >> Gordon, >> >> Forgive me (or ignore this) if it's in the docs. >> >> Does this assume that the ResourceManager.getString call is in the >> binding expression? >> Currently I have some static utilities that load strings like "Hello, >> {0}" from properties files and then do parameter substitution. I've >> been wondering how that would work out in a runtime locale switching >> scenario. >> >> On Fri, Jun 20, 2008 at 2:14 PM, Gordon Smith <[EMAIL PROTECTED]> wrote: >>> You want to learn about the ResourceManager class in Flex 3. It allows >>> you >>> to simply change its localeChain property at runtime and have the entire >>> application redraw in a new language. >>> >>> >>> >>> Gordon Smith >>> >>> Adobe Flex SDK Team >>> >>> >>> >>> ________________________________ >>> >>> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On >>> Behalf Of artur_desig2dev >>> Sent: Friday, June 20, 2008 6:12 AM >>> To: flexcoders@yahoogroups.com >>> Subject: [flexcoders] internationalization @ switching runtime >>> >>> >>> >>> forgive my newbie question.. >>> >>> just wanted to find out the best practice on this to date. >>> on how to change all the components' language at runtime. >>> >>> i found 2 methods of doing this: >>> >>> http://flexme.wordpress.com/2007/07/11/internationalization-in-flex/ >>> >>> http://www.herrodius.com/blog/123 >>> http://flexme.wordpress.com/2007/07/11/internationalization-in-flex/ >>> >>> thanks >>> >>> >> >> > >