|
|
|
|
|
|
|
|
|
|
A beginners guide to developing localized applications (continued)
Text manager and international manager There are two managers provided with the Palm OS, the text manager and the international manager. They're both designed to help you with localized strings and characters. The text manager lets you work with text, strings, and characters independent of the character encoding. The international manager detects the character coding being used by the particular Palm OS device and initializes the corresponding version of the text manager.
Both managers are supported starting in Palm OS version 3.1. If your application needs to work on older systems, you need to test for the presence of these managers before using text manager calls.
Strings The Latin alphabet used by most European languages is relatively small. Therefore, its characters can be represented with a single-byte encoding ranging from 32 to 255. Asian languages, on the other hand, have their own alphabets, which tend to be quite large. Thus, these character sets are represented by a combination of single-byte and double-byte numeric codes ranging from 32 to 65,535.
On systems supporting the international and text managers, strings are made up of characters up to four bytes. Character variables are always two bytes long, but low ASCII (American Standard Code for Information Interchange) characters might be shrunken to a single byte by the operating system when you add them to a string.
Here are a few localization guidelines the Palm Web site recommends:
- If you use the English language version of the software as a guide when designing the layout of the screen, try to allow extra space for strings and larger dialogs than the English version requires;
- Don't put language-dependent strings in code. If you have to display text directly on the screen, remember that a one-line warning or message in one language may need more than one line in another language;
- Don't depend on the physical characteristics of a string, such as the number of characters, the fact that it contains a particular substring, or any other attribute that might disappear in translation;
- Use as many parameters as possible to give localizers greater flexibility;
- Avoid building sentences by concatenating substrings together, as this often causes translation problems;
- Abbreviations may be the best way to accommodate the particularly scarce screen real estate on the Palm OS device;
- Remember that user interface elements such as lists, fields, and tips scroll if you need more space.
For more interface guidelines, visit http://oasis.palm.com/dev/kb/manuals/1726.cfm.
Manipulating strings
Be careful not to point to an intra-character boundary (a middle or end byte of a multi-byte character) whenever you want to work with character pointers. Any time you want to set the insertion point position in a text field or set the text field's selection, you need to use byte offsets that point to inter-character boundaries (the start of one character and the end of the previous character, except when the offset points to the very beginning or very end of a string).
[ Prev | Next ]
|
|
|
|
|
|
|
|
|
|
|
|
|