adding the key/value pairs in /locales/resources.xy_AB.txt files and adding the locales directory as a source directory (locales directory is outside the source folder)

againg using LocaleUtil.sortLanguagesByPreference function to determine the list of most suitable languages

i wrote a new class LocalesManager with a function initData(locale:String, resource:String, format:String = "txt"):void, which can be called various times for different resources, where the function loads the correct file, parses it and stores the found key/value pairs in a Dictionary, which itself will be stored in a Dictionary that handles the resources

after every successful initData call the function dispatches an Event that the loading is finished

to receive a localized string i wrote another function getString(resource:String, key:String):String

That's it. When switching the language on my mobile device i get the strings back for the new language.

I'm having exactly the same problem here (AIR 3.6, Flash Builder 4.7). But somehow I don't really feelcomfortable to write my own LocalizationManager when there's a built-in solution around. So I'm still tryingto find the problem.

I noticed that when I update the compiler argument (-locale=en_US,de_DE ), the ResourceManager*sometimes* switches the language, but somehow randomly and definitely not based the value set for localeChain.

Furthermore, ResourceManager.getInstance().getLocales() does not return anything.

The strange thing: Even when I do not include the localization resources ('locale/{locale}' inActionScript Build Path -> Source Path) the resources in 'locale/en_US' or 'locale/de_DE' are available to theResourceManager.

Since i use my own locales handler now i didn't investigate that problem further.

You describe exactly the same points i struggled with and couldn't solve. With the new solution i have seen that the .properties files still were not added to the build, therefore i changed them to .txt files.

Perhaps you could try that for your project.

If that doesn't help i can only encourage you to create your own LocalizationManager class. It took me 1h to write it and works without problems since then.

I'm definitely close to build my own localization solution based on your proposal!

As far as I understand, it is expected behaviour that the .properties files do not get packed into the build as their content is compiled into the app with [ResourceBundle("resources")]. This would also explain why the compiled app is slightly smaller in filesize when compiled without the -locale parameter. It looks like it is not neccessary to add the directories "locale/{locale}" into the package (in Properties > ActionScript Build Path > Source Path). That's how I understand the documentation:

When your application starts, the ResourceManager is automatically populated with whatever resource bundles were compiled into the application. If you create a code module, by default the resources that its classes need are compiled into the module. When the module is loaded into an application, any bundles that the application does not already have are added to the ResourceManager.

I'm not really sure about the parsing part. I currently use String.split() twice: First to break the file contents into single lines and then to break the lines into key/value-pairs. After that, whitespace is cleaned using StringUtil.trim() (lines 242 - 261). Maybe this could be optimized for efficiency.

Do you have a better solution for parsing? Would be great if you would let me know!