Use automatic language detection with the default language

You can change the default runtime language to any language that you selected as an available language. When automatic language detection is on, and you view the SWF file on the system that uses the language, any system that is set to a language other than one of the active languages uses the default language. For example, if you set your default language to English and you select ja, en, and fr as active languages, users who have their system language set to Japanese, English, or French automatically see text strings in their chosen language. However, users who have their system language set to Swedish, which is not one of the selected languages, automatically see text strings in the default language you selected—in this case, English.

  1. Select Window > Other Panels > Strings, and click Settings.
  2. In the Default language menu, select the default language. This must be a language you added as an available language.
  3. To enable automatic language detection, select Replace Strings Automatically At Runtime, and click OK.
  4. Flash generates the following ActionScript™, which stores the language XML file paths. Use this code as a starting point for your own language detection script.
    import mx.lang.Locale;
    Locale.setFlaName("<flaFileName>");
    Locale.setDefaultLang("langcode");
    Locale.addXMLPath("langcode", "url/langcode/flaname_langcode.xml");
Note: The ActionScript code that the Strings panel generates does not use the Locale.initialize function. Decide how to call this function based on the language detection customizations your project requires.

  This page on the Web