THIS ARTICLE IS UNDER CONSTRUCTION
Contents |
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.
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.
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
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>-<ISO3166‑1 country>. for example en-GB
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.