Flex already has the concept of resource bundles. You put your
localizable strings in .properties files, which get compiled into
ResourceBundle classes. You can then fetch strings out of the
ResourceBundles, most easily in MXML with the @Resource() directive. The
docs have info about this..

 

- Gordon

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Giles Roadnight
Sent: Thursday, December 07, 2006 9:30 AM
To: [email protected]
Subject: [flexcoders] Best practice: string tables

 

Hi All.

 

In my previous flash projects we've had a string table of sorts set up
so that all the strings in the application can be edited easily. We can
also easily modify the strings for foreign users.

 

I have taken this idea and implemented it in Flex as follows.

In the main application I have this code:

 

[Bindable]

public var dialogueText:Object = {

            loginBoxHeader:"Member Login",

 

to set up the string table (obviously other strings in there as well).

 

In my login component I have the following:

 

[Bindable]

private var mainApplication:Object = mx.core.Application.application;

 

and

 

<mx:Label x="10" y="12"
text="{mainApplication.dialogueText.loginUsername}"/>

 

Is this the best way of doing this or will having all of these bound
variables around the place slow things down?

Is there a better way of doing this?

 

Many Thanks

 

Giles Roadnight

 

 

Reply via email to