|
- Author:
- keinfarbton (IP: 84.161.94.155)
- Timestamp:
- 12/08/07 16:19:23 (16 years ago)
- Comment:
Initial version. Copy of some ddoc and links to modules.
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ChapterLocale
v0 |
v1 |
|
| 1 | [[TOC()]] |
---|
| 2 | |
---|
| 3 | = Locale = |
---|
| 4 | |
---|
| 5 | == Culture == |
---|
| 6 | |
---|
| 7 | '''Docs:''' [[docs(Culture,tango.text.locale.Core.html)]] |
---|
| 8 | |
---|
| 9 | Provides information about a culture, such as its name, calendar and date and number format patterns. |
---|
| 10 | '''Remarks:''' tango.text.locale adopts the RFC 1766 standard for culture names in the format <language>"-"<region>. |
---|
| 11 | <language> is a lower-case two-letter code defined by ISO 639-1. <region> is an upper-case |
---|
| 12 | two-letter code defined by ISO 3166. For example, "en-GB" is UK English. |
---|
| 13 | |
---|
| 14 | There are three types of culture: invariant, neutral and specific. The invariant culture is not tied to |
---|
| 15 | any specific region, although it is associated with the English language. A neutral culture is associated with |
---|
| 16 | a language, but not with a region. A specific culture is associated with a language and a region. "es" is a neutral |
---|
| 17 | culture. "es-MX" is a specific culture. |
---|
| 18 | |
---|
| 19 | Instances of [[docs(DateTimeFormat,tango.text.locale.Core.html)]] and [[docs(NumberFormat,tango.text.locale.Core.html)]] cannot be created for neutral cultures. |
---|
| 20 | Examples: |
---|
| 21 | |
---|
| 22 | {{{ |
---|
| 23 | #!d |
---|
| 24 | import tango.io.Stdout, tango.text.locale.Core; |
---|
| 25 | |
---|
| 26 | void main() { |
---|
| 27 | Culture culture = new Culture("it-IT"); |
---|
| 28 | |
---|
| 29 | Stdout.formatln("englishName: {}", culture.englishName); |
---|
| 30 | Stdout.formatln("nativeName: {}", culture.nativeName); |
---|
| 31 | Stdout.formatln("name: {}", culture.name); |
---|
| 32 | Stdout.formatln("parent: {}", culture.parent.name); |
---|
| 33 | Stdout.formatln("isNeutral: {}", culture.isNeutral); |
---|
| 34 | } |
---|
| 35 | }}} |
---|
| 36 | |
---|
| 37 | Produces the following output: |
---|
| 38 | {{{ |
---|
| 39 | englishName: Italian (Italy) |
---|
| 40 | nativeName: italiano (Italia) |
---|
| 41 | name: it-IT |
---|
| 42 | parent: it |
---|
| 43 | isNeutral: false |
---|
| 44 | }}} |
---|
| 45 | |
---|
| 46 | The users Culture can be obtained by using the zero argument constructor: |
---|
| 47 | {{{ |
---|
| 48 | #!d |
---|
| 49 | Culture culture = new Culture(); // users culture |
---|
| 50 | }}} |
---|
| 51 | |
---|
| 52 | '''Note:''' On linux this first looks at the environment variable "LC_ALL" then at "LANG". |
---|
| 53 | |
---|
| 54 | == Convert == |
---|
| 55 | |
---|
| 56 | '''Docs:''' [[docs(Convert,tango.text.locale.Convert.html)]] |
---|
| 57 | |
---|
| 58 | Convert date and time to culture specific output. |
---|
| 59 | |
---|
| 60 | == Collation == |
---|
| 61 | |
---|
| 62 | '''Docs:''' [[docs(Collation,tango.text.locale.Collation.html)]] |
---|
| 63 | |
---|
| 64 | String comparison |
---|
| 65 | |
---|
| 66 | == Locale == |
---|
| 67 | |
---|
| 68 | '''Docs:''' [[docs(Locale,tango.text.locale.Locale.html)]] |
---|
| 69 | |
---|
| 70 | A Layout which does number formating in a culture sensitive way. |
---|
| 71 | |
---|
| 72 | == Parse == |
---|
| 73 | |
---|
| 74 | '''Docs:''' [[docs(Parse,tango.text.locale.Parse.html)]] |
---|
| 75 | |
---|
| 76 | Parse dates and time with given culture. |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
|
|
|
|
|
Copyright © 2006-2024 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic