History | Log In     View a printable version of the current page.  
Issue Details (XML)

Key: SDK-15573
Type: Minor Enhancement Minor Enhancement
Status: Resolved Resolved
Resolution: Fixed
Priority: A A
Assignee: Robert Vollmar
Reporter: Dragos Georgita
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Flex SDK

[Localization support] There is need for a sorting function that selects app locales against system preferences

Created: 05/15/08 07:34 AM   Updated: Yesterday 07:41 PM
Component/s: Runtime Localization
Security Level: Public (All JIRA Users )

File Attachments: 1. Text File LocaleSorting_1714.patch (23 kb)


Severity: Incorrectly Functioning
Reproducibility: Every Time
Discoverability: Medium
Found in Version: SDK Gumbo Iteration 6
Milestone: SDK Flex 3.1.0
Steps to Reproduce:
Steps to reproduce:
1.
2.
3.
 
 Actual Results:
 
 
 Expected Results:
 
 
 Workaround (if any):
 
 
 
Language Found: English
Bugbase Id: none
Triaged: Yes
Regression: No
QA Owner: Robert Vollmar
Resolved by: Gordon Smith
Participants: Deepa Subramaniam, Dragos Georgita, Gordon Smith and Robert Vollmar


 Description  « Hide
Especially in the context of AIR applications, developers need a function that matches those locales from the application against user preferences (expressed via Capabilities.language / languages)

 All   Comments      Sort Order:
Deepa Subramaniam - [07/02/08 06:59 PM ]
To Gordon for 3.1.

Robert Vollmar - [07/02/08 07:43 PM ]
Moving from "Enhancement Request" to "Minor Enhancement" so it will appear in queries. I gave it an "A" priority b/c I know we're doing it in the next day or so.

Gordon Smith - [07/03/08 07:39 PM ]
Fixed by applying the patch, with modifications, to the 3.1.0 branch as revision 2366.

This enhancement affects the default localeChain at startup when you don't specify it in an HTML wrapper. The localeChain is now sorted based on the system's preferred locales, as determined from the Capabilities.languages and Capabilities.language APIs.

For example, suppose an app has been compiled with -locale=en_US,fr_FR,de_DE. Before this enhancement, the default localeChain would be [ "en_US", "fr_FR", "de_DE" ] regardless of the system you were running on. But now, if Capabilities.languages reports that the system's preferred locales are [ "fr-CA", "de" ], the localeChain will be [ "fr_FR", "de_DE", "en_US" ], with the result that the French resources are used rather than the English ones.

The module factory classes SystemManager and FlexModuleFactory, which initialize the localeChain if it hasn't been set by the HTML wrapper, used to simply set the localeChain to the list of compiled locales. They now use a new IResourceManager method, initializeLocaleChain() to set the localeChain in a more intelligent way, passing the list of compiled locales to this method. It in turn determines the list of the system's preferred locales and passes the two lists to a new utility method, LocaleSorter.sortLocalesByPreference(). This returns the first list sorted according to the second list, and the result gets assigned as the localeChain. (Note: The LocaleSorter class will not be documented.)

In addition, IResourceManager has a new getPreferredLocaleChain() method. It is similar to getLocales() but sorts the locale list based on the system's preferred localse. After loading resource modules or adding ResourceBundles into the ResourceManager, you can do

resourceManager.localeChain = resourceManager.getPreferredLocaleChain()

to set the localeChain to an intelligently-sorted list (the locales for which resources are available, sorted by what the user prefers to see).

Gordon Smith - [07/03/08 07:41 PM ]
Rob, please see me for some test data that the Romania team provided.