capabilities.language Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
capabilities.language Property Flash 6

the current language setting on the operating system read/write
System.capabilities.language

Description

The string language property contains a two-letter code representing the language used for text on the operating system. The cross-platform codes used are a subset of those in the ISO-639-1 standard, "Codes for the Representation of Names of Languages" (see http://lcweb.loc.gov/standards/iso639-2/englangn.html). For example, "en" indicates English, and "fr" indicates French. Where applicable, language also includes a two-letter country code indicating the local variant of the language, as defined by ISO 3166 (see http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html). A hyphen separates the language code from the country code, if both are present. For example, "en-UK" indicates English, United Kingdom variant.

By checking the language setting, a movie can intelligently provide text in the appropriate language for the user's system. Multiple language assets can be embedded directly into a single movie or loaded dynamically as variables, XML, or entire movies.

The corresponding server string for language is LAN, with possible values listed in Table 18-4. See capabilities.serverString for details.

Table 18-4. Flash language codes

Language

ISO 639-1 language code

ISO 3166 country code

English, United States

en

US

English, United Kingdom

en

UK

French

fr

 

Korean

ko

 

Japanese

ja

 

Swedish

sv

 

German

de

 

Spanish

es

 

Italian

it

 

Simplified Chinese

zh

CN

Traditional Chinese

zh

TW

Portuguese

pt

 

Polish

pl

 

Hungarian

hu

 

Czech

cs

 

Turkish

tr

 

Finnish

fi

 

Danish

da

 

Norwegian

no

 

Dutch

nl

 

Russian

ru

 

Other/Unknown

xu

 

Bugs

The English language country codes (UK and US) are not properly set by all versions of Flash Player 6; In both countries, System.capabilities.language returns "en" and does not include a country code.

Example

The following code loads the English or French version of a movie, depending on the current language setting:

if (System.capabilities.language.substring(0,2) =  = "en") {   trace("English language");   content_mc.loadMovie("news-english.swf"); } else if (System.capabilities.language =  = "fr") {   trace("French language");   content_mc.loadMovie("news-french.swf"); }

See Also

Character Encoding," in Chapter 4



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net