background image
C H A P T E R 2 0
Localizing Newton Applications
Using the Localization Features of the Newton
20-9
The
RemoveLocale
function accepts as its argument a symbol specifying the
locale bundle it is to remove. The following code shows how to pass the locale
bundle's symbol to this function:
RemoveLocale('|myLocaleBundle:PIEDTS|);
Changing the Active Locale
20
The
SetLocale
function searches for a specified locale bundle and makes that
bundle the active locale bundle. This is equivalent to the user setting the Country
value from the Country pop-up menu, and overrides the user's action. You should,
therefore, save the previous setting and reset it when you finish using your locale.
This function accepts as its argument a symbol identifying the bundle to install.
The following code example shows how to use the
SetLocale
function to install
the custom locale frame created in "Defining a Localization Frame" (page 20-4):
SetLocale('|myLocaleBundle:PIEDTS|);
Using a Localized Country Name
20
When the name of a country is stored in a soup, the program that stores it should
call
SetCountryClass
on the name string. That function sets the string to a
class that represents the country so that if the soup entry is read on a Newton with a
different ROM, a program can use
GetCountryEntry
to get the name of the
country in that ROM's language. See "Obtaining Information About a City or
Country" (page 19-28) for information on using
GetCountryEntry
.
Summary: Customizing Locale
20
The following code sample summarizes the information discussed in the
preceding sections:
// get a bundle to use as a proto
usLocaleBundle := FindLocale('usa);
// define your custom locale bundle
myLocaleBundle :=
{
_proto: usLocaleBundle,
// add slots to be modified here
title: "myLocaleBundle:PIEDTS",
localeSym: '|myLocaleBundle:PIEDTS|,
}
// add myLocaleBundle to the system
AddLocale(myLocaleBundle);
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна