You seem to be wanting to have "UPD" and "BBS" as some kind of
sublocales within an "en_US" locale, and to switch between them by
changing the localeChain. But the ResourceManager doesn't have any
concept of sublocales; it's a simple two-tier system with bundles inside
of locales. (I suppose you could have two locales called en_US_UPD and
en_US_BBS with a "config" bundle inside each one. Or you could have
en_US with two bundles named "upd" and "bbs".)

 

Is there some reason why you're trying to use the ResourceManager for
app configuration rather than for localization? For configuration, I'd
suggest using XML files to specify the UPD and BBS views and attributes.

 

Gordon Smith

Adobe Flex SDK Team

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Durres76
Sent: Thursday, May 29, 2008 8:30 AM
To: [email protected]
Subject: [flexcoders] loading resource bundles manually in flex3

 

Hi,
i'm trying to use the .properties files to configure my app. This is
outside of the general localization discussions and i'm running into a
few problems. i'm building an internal global tool and want to use
property files to define the specific views and attributes for each
section. in my project i have a folder called: properties and in it
there is a folder for en_US.
inside of en_US i have two folders, one for each section: UPD and BBS.
each of those folders have their own config.properties file.
the compile directives look like this: -locale=en_US
-allow-source-path-overlap=true
-source-path=properties/{locale}/UPD,properties/{locale}/BBS

in my application there is a drop down with BBS and UPD options. I
want to switch to the correct bundle when a user changes the dropdown
values. attached is the code for the dropdown and the switching.

can someone tell me how to point to the correct bundles?

Thanks,
d

Attach Code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
layout="vertical"
xmlns:view="com.view.*"
xmlns:admin="com.view.adminScreens.*">

<mx:Script>
<![CDATA[
import com.model.ModToolModel;
import mx.resources.ResourceBundle;

[Bindable]
private var resources:Array = [
"properties/{locale}/BBS","/en_US/UPD", "en_US" ];

[Bindable]
public var model : ModToolModel = ModToolModel.getInstance();

private function comboChangeHandler():void {
// Set the localeChain to either the one-element Array
// [ "en_US" ] or the one-element Array [ "es_ES" ].
resourceManager.localeChain = [ localeComboBox.selectedItem ];
}
]]>
</mx:Script> 

<mx:Metadata>
[ResourceBundle("config")]
</mx:Metadata>

<admin:CollectionList/>
<mx:Label text="properties: {resourceManager.getString('config',
'test')}"/>
<mx:ComboBox id="localeComboBox" 
dataProvider="{resources}"
change="comboChangeHandler()"
/>
</mx:Application>

 

Reply via email to