Introduction to resource bundles

A resource bundle is a list of assets that is organized by locale. These assets can be just about anything, from strings, numbers, formats, and images to styles. You typically have a separate resource bundle for each locale that your application supports.

To localize an application with resource bundles, you first create properties files that define the localized assets. You then compile these properties files into the application as resource bundles, or create resource modules from the properties files and load them at run time.

Flex lets you change locales on the fly; if you compile more than one resource bundle into an application, you can toggle the resource bundle based on the locale. In addition, if you compile resource modules, you can load and unload the SWF files at run time based on the locale. You can even create new resource bundles programmatically.

How you load your resource bundles depends on how many locales your application supports:
  • If your application supports just one or two locales, then you typically compile all the resources into the application. For more information, see Using resource bundles.

  • If your application supports many locales, you will likely want to load the appropriate resources at run time rather than compile all supported resources into the application at compile time. To do this, you compile your resource bundles into resource modules. For more information, see Using resource modules.

If your application only needs to format numbers, currencies, and sort orders, you can use the built-in support for localization in the spark.globalization.* classes without using resource bundles.