Developing Multi-Lingual Applications
By Tiziana Perinotti, TGP Consulting
I will begin the first of this series of localization talks with an article based on my
experience in developing internationalized software that can be localized into different
languages simultaneously.
The Mac application I've helped develop for a company in the Silicon Valley,
California, is capable of switching from one language to another on the fly. The user can
switch from a French to a German user interface through a language selection dialog box
under the Preference menu, without having to exit the application and start it again under
a different language.
The application supports: Kanji, French, German, Italian and Spanish.
The first issue with localization is to find what current language the operating system
is running. For instance, you can find if you are running the Mac system 7.x Italian,
Kanji, or French version.
One way of accomplishing this is to store the index into a global currLang off the
pointer globsP. The index is defined as:
- 0=US
- 1=Germany
- 2=France
- 3=Spain
- 4=Italy
- 5=Japan
Then you write code that finds current country to determine resource offset. With the
offsets, you get the STR# or TEXT/styl as you need.
There are many ways to implement the retrieval of the correct resource; one way is to
do the following:
- For STR# resources
- each resource will contain all localized versions of that string and then use currLang
as an index into the STR# resource.
For TEXT/styl resources
- each particular message would be accessed from some base ID. For example, if the English
help resource ID is 130, then the German is ID 131 and the French is ID 132, etc. For the
next message for the About... text, you can give it an ID of 140 for English and then
count up again.
This scheme works fine for 10 or fewer languages.
When you change language on the fly, you can present the user with a dialog for
selection. If the selection is different than the previous one, you change the globsP
currLang, change any static text and control titles and then update the controls.
In general, when developing International SW for the Mac, keep in mind the following:
- Customize for enabled scripts
- Is more than one script installed?
- Is this script installed?
- Is this feature available?
- Access Script Resources Explicity
- Support Font Substitution
- Support Multiscript Font Menus
- Support Inline text Entry