Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Archived:Flash lite localisation

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Article Metadata
Code ExampleArticle
Created: Risalmin (06 Nov 2009)
Last edited: hamishwillee (14 May 2013)


Basic information

The following is one way of localising texts at runtime. In order for it to work, the SWF needs to be packaged, since the localisation text files will be separate.

For a more advanced example with a helper class go to Advanced example and helper class section at the bottom of the page!

Set variables to Dynamic text fields

To be able to switch the texts at runtime, you need to define your texts as dynamic text fields and you need to set a variable for each of them.

  1. Add a dynamic text field (or change the text field to dynamic)
  2. In the field's Properties panel set the Variable field in the Options section to the desired value

Save the localisation data to an external text file

To be able to localise the text properly, the translator need some information. Please make sure you provide enough data for a correct translation to be possible. Also, it is very important to let the translator know how much room the text has on the screen.

You could format the string in the following manner, following the Symbian i18n guidelines.

//d: A descriptive text, describing the use of the text string and it's
//d: dependencies. Should be more than a few words and can extend to several
//d: lines. This must always preceed the actual string definition
//l: Information about the layout use one of the predefined values
&logical_name=The localisation string&

NOTE: all characters, also linebreaks and whitespace between the "equals" sign (=) and the next ampersand (&) will be returned as the value

Detecting the device language and loading the floc file

The following code uses first the fscommand "GetLanguage" to set the value of variable isoLang to the devices language. The returned value may vary a bit, but at least in the S60 5th edition devices the value is <ISO639‑1 language alpha-2>-<ISO3166‑1 country alpha-2>, for example en-GB or es-ES.

status = fscommand2("GetLanguage", "isoLang");
loadVariables(isoLang+".floc", _root);

The second line uses the language information to load the variable data to the dynamic text fields. In this example, the file is given an extension .loc but it is not an official file extension...


The following example (Adobe Flash Professional CS4) uses the method described above.

Advanced example and helper class

This package contains a similar Flash CS3 FLA file as the basic example, but it includes a very handy helper class to do most of the work for you automatically. It had been developed as a part of an application already in Nokia Store after which it was generalised and open sourced for use in any other project!

What does class do for you?

  • gets the system language
  • intelligently tries to match it with the list of available languages
    • first trying a full match
    • if that fails trying to match only the language
    • and finally as a last resort loading the default one you can specify
  • loads the text labels from the external files automatically
  • does the loading asynchronously and gives you a hook to a callback function
  • makes all the labels available as static variables, so no need to pass an instance of the Language class around, you can access text labels from anywhere
  • works perfectly as part of a more advanced, class based project, in fact it`s MTASC strict compliant


  1. copy in and in your project folder
  2. paste in to and edit code in your project from FLA example
  3. edit FLOC files
  4. update variables in based on your FLOC files (FLOC variable name = variable name in uppercase, loader handles this automatically)
  5. package your FLOC files together / next to your SWF
  6. automatically load the right language runtime before drawing your GUI

This page was last modified on 14 May 2013, at 06:03.
52 page views in the last 30 days.