Multilanguage text and actionscript – Adobe Flash Professional CC 2014 v.13.0 User Manual
Page 303
Translate text in an XML file
1. Using an XML file editor or translating software, open the folder for the desired language, then the XML file for that language. The XML file is
populated with the IDs for each text string.
2. Enter the text string for the language next to the ID.
3. If necessary, import the translated XML file into the Strings panel.
Import an XML file into the Strings panel
After you modify an XML file, if you place it in the folder specified in the Strings panel for that language, the XML file is loaded into the Flash
Professional document (FLA file) when it opens.
Regardless of where the XML file you imported was located, when you save, test, or publish the FLA file, a folder for each language in the Strings
panel and an XML file for each language are created in the location indicated for publishing SWF files. If no publish path is indicated, the folder
and file are saved in the same folder in which the FLA file is located. The XML files that the Strings panel generates are always populated with the
information in the Strings panel.
Alternatively, import an XML file into the Strings panel from another location. After you import it, when you save, test, or publish the file, the XML
file in the folder specified for that language is overwritten. You cannot import an XML file for a language unless it is already selected as an
available language in the Strings panel. You can also add a language and import an XML file with the translation for that language.
1. Select Window > Other Panels > Strings, and click Import XML.
2. In the Select a Language menu, select the language of the XML file you are importing, and click OK.
3. Navigate to the folder and XML file to import.
The XML information is loaded into the column in the Strings panel for the language you selected in step 3.
Note: Select the same language in steps 2 and 3. Otherwise, you could, for example, import a French XML file into the column for German.
Multilanguage text and ActionScript
You can control multilanguage text and import multilanguage XML files with ActionScript®.
Use ActionScript to load external files
To load existing XML data, or use a different format for the XML file, use the loadVariables action, the getURL action, the LoadVars object, or the
XML object to create a document that contains multilanguage text by placing the text in an external text or XML file and loading the file into the
movie clip at runtime.
Save the external file in UTF-8 (recommended), UTF-16BE, or UTF-16LE format, using an application that supports the format. If you are using
UTF-16BE or UTF-16LE format, the file must begin with a BOM to identify the encoding format to Flash Player. The following table lists the BOM
to include to identify the encoding:
Note: Most text editors that can save files in UTF-16BE or LE automatically add the BOMs to the files.
UTF Format
First Byte
Second Byte
UTF-16BE
OxFE
OxFF
UTF-16LE
OxFF
OxFE
Note: If the external file is an XML file, you cannot use an XML encoding tag to change the file encoding. Save the file in a supported Unicode
format.
1. In the Flash Professional authoring application, create a dynamic or input text field to show the text in the document.
2. In the Property inspector, with the text field selected, assign an instance name to the text field.
3. Outside of Flash, create a text or XML file that defines the value for the text field variable.
4. Save the XML file in UTF-8 (recommended), UTF-16BE, or UTF-16LE format.
5. Use one of the following ActionScript procedures to reference the external file and load it into the dynamic or input text field:
Use the loadVariables action to load an external file.
Use the getURL action to load an external file from a specified URL.
Use the LoadVars object (a predefined client-server object) to load an external text file from a specified URL.
Use the XML object (a predefined client-server object) to load an external XML file from a specified URL. For more information, see XML
in the
.
Create multilanguage documents using the #include action
To create a document that contains multiple languages, use the #include action.
296