Chapter 11

Internationalization

Examples

Recipe 11.1
Formatting a Date

Format a Date object.

Recipe 11.2
Getting the Parts of a Formatted Date

Format a Date object.

Recipe 11.3
Formatting a Relative Date

Format another date relative to the current date.

Recipe 11.4
Formatting Numbers

Format a number to provide locale-specific decimal and thousands separators.

Recipe 11.5
Rounding Decimal Places

Round a number to a fixed number of decimal places.

Recipe 11.6
Formatting a Price Range

Print a price range calculated from an array of prices.

Recipe 11.7
Formatting Measurement Units

Format measurement units.

Recipe 11.8
Applying Pluralization Rules

Format a message differently depending on the number of items.

Recipe 11.9
Counting Characters, Words, and Sentences

Split up a string into locale-specific segments to count words and sentences.

Recipe 11.10
Formatting Lists

Combine strings together into a locale-specific list format.

Recipe 11.11
Sorting an Array of Names

Apply locale-specific logic to compare strings when sorting an array of names.

Web API Cookbook
Joe Attardi