beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 745

background image

C H A P T E R 2 0

Localizing Newton Applications

Using the Localization Features of the Newton

20-13

// get the current time

theTime:= Time();

// pass the time and the format to LongDateStr

LongDateStr(theTime,kmyDateSpec);

This example is deliberately verbose for purposes of illustrating how to build a
format specification array.

The kIncludeAllElements Constant

20

If you want to use the default format for time or date strings as specified by the
active locale bundle, you can pass the

kIncludeAllElements

constant to the

functions

LongDateStr

,

ShortDateStr

, and

TimeStr

. You’ll get the results

summarized inTable 20-1.

Currency Values

20

Currency strings reflect localized formatting characteristics that distinguish them
from other number strings. They

typically display a prefix or suffix indicating their denomination

may require an additional prefix and/or suffix that indicates whether the amount
is negative.

Currency strings must also adhere to regional conventions for

grouping numbers

the delimiter that indicates these groupings

the character that represents the decimal point

These values are stored in a frame in the active locale bundle’s

numberFormat

slot.

For example, the

currencyPrefix

slot stores the value

"$"

for the U.S. locale

and

"£"

for the United Kingdom locale, while in the French Canadian locale, the

currencyPrefix

slot has no value and the

currencySuffix

slot stores the

value

"$"

.

Table 20-1

Using the

kIncludeAllElements

constant

Function

Format of output

LongDateStr

day of week, month, day, year in locale’s default format

ShortDateStr

year, month, day in locale’s default short date format

TimeStr

hour, minute, second, AM/PM, and suffix