C H A P T E R 2 0
Localizing Newton Applications
Using the Localization Features of the Newton
20-7
For example:
activeLocale:=GetLocale();
Once you've obtained a bundle, you can examine it to see how your application
should interpret user input or display output.
See "Contents of a Locale Bundle" (page 17-1) in Newton Programmer's
Reference for information on the slots of a locale bundle.
Changing Locale Settings
20
You cannot change settings in the active locale bundle. To change locale settings,
you need to create a new locale bundle that has the values you want and make it the
active locale. This is called a custom locale bundle. See the next section for
information on how to create on of those.
Creating a Custom Locale Bundle
20
Every custom locale bundle has a
_proto
slot that references another locale
bundle. To create your application's custom locale bundle, use the
FindLocale
function to get the frame to be referenced by your custom locale bundle's
_proto
slot.
IMPORTANT
Your custom bundle's
_proto
slot must ultimately reference a
system-supplied locale bundle. That does not have to be direct--
you can reference a custom bundle that you know references a
system-supplied bundle, for example.
Your custom locale bundle is simply a frame that includes this
_proto
reference
and any additional slots you wish to define to override the values of those inherited
from the prototype. Your custom locale bundle should look like the code in the
following example:
usLocaleBundle := FindLocale('usa);
myLocaleBundle :=
{
_proto: usLocaleBundle,
// add slots to be modified
title: "myLocaleBundle:PIEDTS",
localeSym: '|myLocaleBundle:PIEDTS|,
};
The
FindLocale
function accepts as its argument a symbol specifying the locale
bundle it is to return. This function returns the locale bundle that has this value in
its
localeSym
slot.