background image
C H A P T E R 2 0
Localizing Newton Applications
Using the Localization Features of the Newton
In the preceding code example the
frame is based on the U.S.
locale bundle. It gives a new
value, as it must, but
implements no functional changes to the locale. To make changes to the locale
bundle, you can add your own slots in place of the comment that says
// add slots to be modified
Your custom locale bundle must have a
slot of its own, as well as a
slot that gives the string that you want to appear in the Country pop-up
menu. Since there can't be another locale bundle in the system with the same
symbol as your new bundle, and shouldn't be one with the same title, be careful to
avoid name clashes when creating your bundle's
The problems associated with creating a unique name string for a locale bundle are
similar to those you might encounter when creating a name for a soup; for
suggestions regarding the creation of unique name strings, see "Naming Soups"
(page 11-32). Basically, you should incorporate your developer or application
symbol in the bundle's title and symbol slots.
Adding a New Bundle to the System
Once you have created a locale bundle, you need to make it available to the system
by using the
function. The following code sample shows how to pass
the previously created locale bundle
to this function:
Call kAddLocaleFunc with (myLocaleBundle);
(You call this function in this way because it is a platform file function.)
If the
slot in
is not unique, the new locale
overrides the existing locale with the same symbol. You can override a built-in
locale bundle.
Removing a Locale Bundle
To remove the custom locale bundle you have installed use the system-supplied
As with any shared data, the appropriate time to remove your locale bundle is left
up to you because it can be difficult to determine whether other applications are
using a bundle. Even if your own application is the only one using the custom
locale bundle, it can be difficult to decide whether to remove it. You wouldn't
necessarily want to install it every time the application opened and remove it every
time the application closed.
If you remove the active locale bundle,
makes one of the built-in
locales the active locale; the locale it chooses depends on the ROM version. If your
application makes a new bundle active, you may want to save the symbol of the
previously active bundle, so that you can reset the value before you remove your
locale bundle.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна