About multilanguage text



You can configure a FLA file to display text in different languages depending on the language of the operating system that plays the Flash content.

Multilanguage text in Flash

You can include multilanguage text in your document in the following ways:

  • The Strings panel lets localizers edit strings in a central location in Flash or in external XML files with their preferred software or translation memory. Flash supports multiline strings in both the Strings panel and the XML files.

  • Select which character sets to embed in your applications, which limits the number of character glyphs in your published SWF file and reduces its size.

  • Use a Western-style keyboard to create text on the Stage in Chinese, Japanese, and Korean.

  • If you have Unicode fonts installed on your system, enter text directly into a text field. Because the fonts are not embedded, your users must also have Unicode fonts.

    Other, less common methods of including multilingual text in your Flash documents include the following:

  • Include an external text file in a dynamic or input text field by using the #include action.

  • Load external text or XML files into a Flash application at runtime by using the loadVariables or getURL actions, or the LoadVars or XML objects.

  • Enter Unicode escape characters in the string value for a dynamic or input text field variable.

  • Create an embedded font as a symbol in your Library.

    For Unicode-encoded text to appear correctly, users must have access to fonts containing the glyphs (characters) used in that text.

For a sample of multilingual content, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and navigate to the Text\MultilingualContent folder to access the sample.

About fonts for Unicode-encoded text

When you use external files that are Unicode encoded, your users must have access to fonts containing all the glyphs used in your text files. By default, Flash stores the names of fonts used in dynamic or input text files. During SWF file playback, Flash Player 7 (and earlier versions) looks for those fonts on the operating system running the player.

If the text in a SWF file contains glyphs that the specified font does not support, both Flash Player 7 and Flash Player 8 attempt to locate a font on the user’s system that supports those glyphs. The player cannot always locate an appropriate font. This behavior depends on the fonts available on the user’s system, as well as on the operating system running Flash Player.

Embed fonts for dynamic or input text fields

For dynamic or input text fields, embed fonts. However, some fonts, particularly those used for Asian languages, can add significantly to the SWF file size when embedded. With Flash, you can select ranges of fonts to embed.

You can also embed fonts by creating a font symbol in the library.

Select and embed a range of fonts

  1. On the Stage, select a dynamic or input text field, show the Property inspector (Window > Properties), and click Character Embedding.
  2. Select the range of font sets to embed by doing any of the following:
    • Click a character set in the Character Set text field.

    • Select multiple ranges by Shift-clicking the first and last fonts of a contiguous range of fonts, or by Control‑clicking (Windows) or Command-clicking (Macintosh) to select noncontiguous fonts, click Auto Fill, and then click OK.

Note: Select only the font sets to embed, so you do not exceed the internal maximum number of glyphs for the authoring tool (approximately 65.500). Flash does not perform error-checking to confirm that the selected character set contains glyphs. During the publish or export procedure, only glyphs that are present in the font are embedded in the SWF file.

Embed font sets from text on the Stage

  1. On the Stage, select a dynamic or input text field, show the Property inspector (Window > Properties), and click Character Embedding.
  2. Select the character sets to embed and click AutoFill.

Remove embedded font sets

  1. On the Stage, select a dynamic or input text field, show the Property inspector (Window > Properties), and click Character Embedding.
  2. Click Don’t Embed to remove all of the embedded fonts.
  3. Click OK to close the dialog box, or select other fonts sets to embed in the SWF file.

XML font embedding table

When you select ranges of fonts to embed in a FLA file, Flash uses the UnicodeTable.xml file to determine which characters to embed. The UnicodeTable.xml file contains ranges of characters required for various languages and resides in the user configuration folder of your computer. The is located in the following directories:

  • Windows: <boot drive>\Documents and Settings\<user>\Local Settings\Application Data\Adobe\Flash<version>\<language>\Configuration\FontEmbedding\

  • Macintosh: <user>/Library/Application Support/Adobe/Flash <version>/<language>/Configuration/FontEmbedding/

The font set groupings are based on the Unicode Blocks as defined by the Unicode Consortium. To provide a simpler workflow, when you select a particular language, all related glyph ranges are embedded even if they are scattered into disjointed groupings.

For example, if you select Korean, the following Unicode character ranges are embedded:

3131‑318E Hangul symbols

3200‑321C Hangul specials

3260‑327B Hangul specials

327F‑327F Korean symbol

AC00‑D7A3 Hangul symbols

If you select Korean + CJK, a larger font set is embedded:

3131‑318E Hangul symbols

3200‑321C Hangul specials

3260‑327B Hangul specials

327F‑327F Korean symbol

4E00‑9FA5 CJK symbols

AC00‑D7A3 Hangul symbols

F900‑FA2D CJK symbols

The following table gives more details about the font selections for embedded fonts:

Range

Description

Uppercase [A–Z]

Basic Latin uppercase glyphs

Lowercase [a–z]

Basic Latin lowercase glyphs

Numerals [0–9]

Basic Latin numeral glyphs

Punctuation [!@#%...]

Basic Latin punctuation

Basic Latin

Basic Latin glyphs within the Unicode range 0x0021 to 0x007E

Japanese Kana

Hiragana and Katakana glyphs (including half-width forms)

Japanese Kanji – Level 1

Japanese Kanji characters

Japanese (All)

Japanese Kana and Kanji (including punctuation and special characters)

Basic Hangul

Most commonly used Korean characters, Roman characters, punctuations, and special characters/symbols

Hangul (All)

11,720 Korean characters (sorted by Hangul syllables), Roman characters, punctuations, and special characters/symbols)

Traditional Chinese – Level 1

5000 most commonly used Traditional Chinese characters used in Taiwan

Traditional Chinese (All)

All Traditional Chinese characters used in Taiwan and Hong Kong, and punctuations

Simplified Chinese – Level 1

6000 most commonly used Simplified Chinese characters used in mainland of China and punctuations

Chinese (All)

All Traditional and Simplified Chinese characters and punctuations

Thai

All Thai glyphs

Devanagari

All Devanagari glyphs

Latin I

Latin‑1 Supplement range 0x00A1 to 0x00FF (including punctuation, superscripts and subscripts, currency symbols, and letter-like symbols)

Latin Extended A

Latin Extended‑A range 0x0100 to 0x01FF (including punctuation, superscripts and subscripts, currency symbols, and letter-like symbols)

Latin Extended B

Latin Extended‑B range 0x0180 to 0x024F (including punctuation, superscripts and subscripts, currency symbols, and letter-like symbols)

Latin Extended Add'l

Latin Extended Additional range 0x1E00 to 0x1EFF (including punctuation, superscripts and subscripts, currency symbols, and letter-like symbols)

Greek

Greek and Coptic, plus Greek Extended (including punctuation, superscripts and subscripts, currency symbols, and letter-like symbols)

Cyrillic

Cyrillic (including punctuation, superscripts and subscripts, currency symbols, and letter-like symbols)

Armenian

Armenian plus ligatures

Arabic

Arabic plus Presentation Forms‑A and Presentation Forms‑B

Hebrew

Hebrew plus Presentation Forms (including punctuation, superscripts and subscripts, currency symbols, and letter-like symbols)

Non-Unicode external files

If you load external text or XML files that are not Unicode-encoded into a Flash Player 7 application, the text in the external files does not appear correctly when Flash Player attempts to show them as Unicode. To tell Flash Player to use the traditional code page of the operating system that is running the player, add the following code as the first line of code in the first frame of the Flash application that is loading the data:

system.useCodepage = true;

Set the system.useCodepage property only once in a document; do not use it multiple times in a document to make the player interpret some external files as Unicode and some as other encoding, because this can yield unexpected results.

If you set the system.useCodepage property to true, the traditional code page of the operating system running the player must include the glyphs used in your external text file for the text to appear. For example, if you load an external text file that contains Chinese characters, those characters do not appear on a system that uses the CP1252 code page, because that code page does not include Chinese characters. To ensure that users on all platforms can view external text files used in your Flash applications, encode all external text files as Unicode and leave the system.useCodepage property set to false by default. This causes Flash Player to interpret the text as Unicode. For more information, see useCodepage (System.useCodepage property) in the ActionScript 2.0 Language Reference.

Text encoding

All text in a computer is encoded as a series of bytes. Many different forms of encoding (and therefore, different bytes) represent text. Different kinds of operating systems use different kinds of encoding for text. For example, Western Windows operating systems usually use CP1252 encoding; Western Macintosh operating systems usually use MacRoman encoding; Japanese Windows and Macintosh systems usually use Unicode encoding.

Unicode can encode most languages and characters used throughout the world. The other forms of text encoding that computers use are subsets of the Unicode format, tailored to specific regions of the world. Some of these forms are compatible in some areas and incompatible in other areas, so using the correct encoding is critical.

Unicode has several forms. Flash Player versions 6 and 7 and later support text or external files in the 8‑bit Unicode format UTF‑8, and in the 16‑bit Unicode formats UTF‑16 BE (Big Endian) and UTF‑16 LE (Little Endian).

Unicode and Flash Player

Flash Player 6 and later versions support Unicode text encoding. Users with Flash Player 6 or later can view multilanguage text, regardless of the language that the operating system running the player uses, if they have the correct fonts installed.

Flash Player assumes that all external text files associated with a Flash Player application are Unicode encoded, unless you tell the player otherwise.

For Flash applications in Flash Player 5 or earlier that are authored in Flash MX or earlier, Flash Player 6 and earlier versions display the text by using the traditional code page of the operating system running the player.

For background information on Unicode, see Unicode.org.

Text encoding in Flash Player

By default, Flash Player 7 and later assumes that all text it encounters is Unicode encoded. If your document loads external text or XML files, the text in these files should be UTF‑8 encoded. Create these files by using the Strings panel or using a text or HTML editor that can save the files in Unicode format.

Unicode encoding formats that Flash Player supports

When reading text data in Flash, Flash Player looks at the first two bytes in the file to detect a byte order mark (BOM), a standard formatting convention used to identify the Unicode encoding format. If no BOM is detected, the text encoding is interpreted as UTF‑8 (an 8‑bit encoding format). It is recommended that you use UTF‑8 encoding in your applications.

If Flash Player detects either of the following BOMs, the text encoding format is interpreted as follows:

  • If the first byte of the file is OxFE and the second is OxFF, the encoding is interpreted as UTF‑16 BE (Big Endian). This is used for Macintosh operating systems.

  • If the first byte of the file is OxFF and the second is OxFE, the encoding is interpreted as UTF‑16 LE (Little Endian). This is used for Windows operating systems.

    Most text editors that can save files in UTF‑16BE or LE automatically add the BOMs to the files.

    Note: If you set the system.useCodepage property to true, the text is interpreted using the traditional code page of the operating system that is running the player; it is not interpreted as Unicode.

Encoding in external XML files

You cannot change the encoding of an XML file by changing the encoding tag. Flash Player identifies the encoding of an external XML file using the same rules as for all external files. If no BOM is encountered at the beginning of the file, the file is assumed to be in UTF‑8 encoding. If a BOM is encountered, the file is interpreted as UTF‑16BE or LE.