13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Internationalizing applications<br />

Collator Property Effect<br />

numericComparison Controls whether digit characters are treated as numbers or as text.<br />

ignoreCase Controls whether uppercase and lowercase differ<strong>en</strong>ces are ignored.<br />

ignoreCharacterWidth Controls whether full-width and half-width forms of some Chinese and Japanese characters are<br />

evaluated as equal.<br />

ignoreDiacritics Controls whether strings that use the same base characters but differ<strong>en</strong>t acc<strong>en</strong>ts or other diacritic<br />

marks are evaluated as equal.<br />

ignoreKanaType Controls whether strings that differ only by the type of kana character being used are treated as equal.<br />

ignoreSymbols Controls whether symbol characters such as spaces, curr<strong>en</strong>cy symbols, math symbols, and others are<br />

ignored.<br />

The following code shows that setting the ignoreDiacritics property to true changes the sort order of a list of Fr<strong>en</strong>ch<br />

words:<br />

var words:Array = new Array("COTE", "coté", "côte", "Coté","cote");<br />

var sorter:Collator = new Collator("fr-CA", CollatorMode.SORTING);<br />

words.sort(sorter.compare);<br />

trace(words); // cote,COTE,côte,coté,Coté<br />

sorter.ignoreDiacritics = true;<br />

words.sort(sorter.compare);<br />

trace(words); // côte,coté,cote,Coté,COTE<br />

Case conversion<br />

Flash Player 10.1 and later, Adobe AIR 2.0 and later<br />

Languages also differ in their rules for converting letters betwe<strong>en</strong> uppercase forms (majiscules) and lowercase forms<br />

(miniscules).<br />

For example, in most languages that use the Latin alphabet the lowercase form of the capital letter “I” is “i”. However<br />

in some languages (such as Turkish and Azeri) there is an additional dotless letter “ı”. As a result in those languages a<br />

lowercase dotless “ı” transforms into an uppercase ”I”. A lowercase “i” transforms into an uppercase “İ” with a dot.<br />

The StringTools class provides methods that use language-specific rules to perform such transformations.<br />

Using the StringTools class<br />

The StringTools class provides two methods to perform case transformations: toLowerCase() and toUpperCase(). You<br />

create a StringTools object by calling the constructor with a locale ID. The StringTools class retrieves the case<br />

conversion rules for that locale (or a fallback locale) from the operating system. It is not possible to further customize<br />

the case conversion algorithm.<br />

The following example uses the toUpperCase() and toLowerCase() methods to transform a German phrase that<br />

includes the letter “ß” (sharp S).<br />

Last updated 6/6/2012<br />

950

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!