background image
C H A P T E R 2 0
Localizing Newton Applications
20-10
Using the Localization Features of the Newton
//save the current locale setting
previousLocale:=GetLocale().localeSym;
//install myLocaleBundle as the active locale bundle
SetLocale('|myLocaleBundle:PIEDTS|);
//reset the previous locale setting
SetLocale(previousLocale);
//remove your locale
RemoveLocale('|myLocaleBundle:PIEDTS|);
Localized Output
20
Your application should employ locale-specific user preferences to customize its
handling of numbers, dates, and times. In addition to information available from
the active locale bundle, your application should use the utility functions described
here to display localized strings representing dates, times, and monetary values.
Date and Time Values
20
The Newton system deals with dates and times as either the number of minutes
since midnight, January 1, 1904 or the number of seconds since midnight, January
1, 1993. Those functions are listed in "System Clock Functions" (page 20-15) in
this manual and detailed in "System Clock Functions" (page 17-20) in Newton
Programmer's Reference
.
Obviously, you generally need date and time values in formatted strings that the
user can enter or read. The system has several ways of helping you get these strings:
Some functions use the current locale setting to determine the proper format
Some functions take a format specification as a parameter; in this case, some of
the output (such as the words used for days of the week) are still determined by
the locale setting)
Some functions convert system clock values to and from date frames that have
the pieces of date and time information broken into individual slots
Some parts of the strings returned are always determined by the locale bundle. In
particular, the active locale bundle determines:
The order in which date elements appear
The delimiters that separate the various elements of the date or time string
Words used for months and days of the week
Times always appear in hour/minute/seconds order, although you can use format speci-
fications to vary the display of individual elements and delimiters in the time string.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна