From 8ab196ce6c2d5de323bdd8ebcc11a73814c0cdca Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 26 Apr 2006 21:18:01 +0000 Subject: Merge from 3.0 branch till 971. --- .../quickstart/protected/pages/Advanced/I18N.page | 124 ++++++++++++++++++++- 1 file changed, 123 insertions(+), 1 deletion(-) (limited to 'demos/quickstart/protected/pages/Advanced') diff --git a/demos/quickstart/protected/pages/Advanced/I18N.page b/demos/quickstart/protected/pages/Advanced/I18N.page index f37e5cf6..4a220c4c 100644 --- a/demos/quickstart/protected/pages/Advanced/I18N.page +++ b/demos/quickstart/protected/pages/Advanced/I18N.page @@ -170,23 +170,145 @@ The time is {time}. <com:TDateFormat Value="12/01/2005" /> -

There are of 4 localized date patterns and 4 localized time patterns. They can be used in any combination. If using a combined pattern, the first must be the date, followed by a space, and lastly the time pattern. For example, full date pattern with short time pattern.

+

The Pattern property accepts 4 predefined localized date patterns and 4 predefined localized time patterns. +

+The predefined can be used in any combination. If using a combined predefined pattern, +the first pattern must be the date, followed by a space, and lastly the time pattern. +For example, full date pattern with short time pattern. The actual ordering of the +date-time and the actual pattern will be determine automatically from locale data specified +by the Culture property.

<com:TDateFormat Pattern="fulldate shorttime" /> +

You can also specify a custom pattern using the following sub-patterns. +The date/time format is specified by means of a string time pattern. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following: + + Symbol Meaning Presentation Example + ------ ------- ------------ ------- + G era designator (Text) AD + y year (Number) 1996 + M month in year (Text & Number) July & 07 + d day in month (Number) 10 + h hour in am/pm (1~12) (Number) 12 + H hour in day (0~23) (Number) 0 + m minute in hour (Number) 30 + s second in minute (Number) 55 + E day of week (Text) Tuesday + D day in year (Number) 189 + F day of week in month (Number) 2 (2nd Wed in July) + w week in year (Number) 27 + W week in month (Number) 2 + a am/pm marker (Text) PM + k hour in day (1~24) (Number) 24 + K hour in am/pm (0~11) (Number) 0 + z time zone (Time) Pacific Standard Time + ' escape for text (Delimiter) 'Date=' + '' single quote (Literal) 'o''clock' + +

+ +

The count of pattern letters determine the format.

+ +

(Text): 4 letters uses full form, less than 4, use short or abbreviated form +if it exists. (e.g., "EEEE" produces "Monday", "EEE" produces "Mon")

+ +

(Number): the minimum number of digits. Shorter numbers are zero-padded + to this amount (e.g. if "m" produces "6", "mm" produces "06"). Year is + handled specially; that is, if the count of 'y' is 2, the Year will be + truncated to 2 digits. (e.g., if "yyyy" produces "1997", "yy" produces "97".) + Unlike other fields, fractional seconds are padded on the right with zero.

+ +

(Text and Number): 3 or over, use text, otherwise use number. (e.g., +"M" produces "1", "MM" produces "01", "MMM" produces "Jan", and "MMMM" +produces "January".)

+ +

Any characters in the pattern that are not in the ranges of ['a'..'z'] +and ['A'..'Z'] will be treated as quoted text. For instance, characters +like ':', '.', ' ', and '@' will appear in the resulting time text +even they are not embraced within single quotes.

+ +

Examples using the US locale: + + +Format Pattern Result +-------------- ------- +"yyyy.MM.dd G 'at' HH:mm:ss" ->> 1996.07.10 AD at 15:08:56 +"EEE, MMM d, ''yy" ->> Wed, Jul 10, '96 +"h:mm a" ->> 12:08 PM +"hh 'o''clock' a, z" ->> 12 o'clock PM, Pacific Daylight Time +"K:mm a" ->> 0:00 PM +"yyyy.MMMM.dd G hh:mm a" ->> 1996.July.10 AD 12:08 PM + +

+

If the Value property is not specified, the current date and time is used.

TNumberFormat

PRADO's Internationalization framework provide localized currency formatting and number formatting. Please note that the TNumberFormat component provides formatting only, it does not perform current conversion or exchange.

+

Numbers can be formatted as currency, percentage, decimal or scientific +numbers by specifying the Type attribute. The valid types are: +

+

+ <com:TNumberFormat Type="currency" Value="100" />

Culture and Currency properties may be specified to format locale specific numbers.

+

If someone from US want to see sales figures from a store in +Germany (say using the EURO currency), formatted using the german + currency, you would need to use the attribute Culture="de_DE" to get +the currency right, e.g. 100,00$. The decimal and grouping separator is +then also from the de_DE locale. This may lead to some confusion because +people from US uses the "," (comma) as thousand separator. Therefore a Currency +attribute is available, so that the output from the following example results in $100.00 + +<com:TNumberFormat Type="currency" + Culture="en_US" Currency="EUR" Value="100" /> + +

+ +

The Pattern property determines the number of digits, thousand grouping +positions, the number of decimal points and the decimal position. The actual characters that +are used to represent the decimal points and thousand points are culture specific +and will change automatically according to the Culture property. The valid +Pattern characters are: +

+For example, consider the Value="1234567.12345" and +with Culture="en_US" (which uses "," for thousand point separator and "." for decimal separators). + +Pattern Output +------- ------ +##,###.00 ->> 1,234,567.12 +##,###.## ->> 1,234,567.12345 +##,##.0000 ->> 1,23,45,67.1235 +##,###,##.0 ->> 12,345,67.1 +000,000,000.0 ->> 001,234,567.1 + +

TTranslateParameter

Compound messages, i.e., string substitution, can be accomplished with TTranslateParameter. -- cgit v1.2.3