GEOS SDK TechDocs
|
|
2 How To Use Localization
|
4 International Formats
ResEdit
is a GEOS program which speeds geode translations. This section won't tell you how to use the
ResEdit
tool but will explain how to write your code if you want
ResEdit
to work with it correctly.
The important thing to remember is to put all text and bitmaps to be localized in localizable resources.
ResEdit
looks for localizable objects only in non-code resources. The string or bitmap itself must be stored in a chunk, which you may insure by using either the
@chunk
or
@visMoniker
keywords. (If you're using assembly, you should use the
LocalDefString
macro when setting up localizable strings.) Thus, your application icons are probably stored in the following way:
@start APPSCMONIKERRESOURCE, data
/* Application moniker: */
@visMoniker MyAppSCMoniker = { /* ... */}
@end APPSCMONIKERRESOURCE
At first it might seem surprising that bitmaps should be localized, since pictures are supposed to be a sort of universal language. However, this attitude may seem less strange when you try to distribute software to a culture that finds pictures of yellow arrows offensive.
Your application could keep its strings in a resource in the style illustrated in Storing Strings in Localizable Resources .
Code Display 8-1 Storing Strings in Localizable Resources
@start ErrorStrings, data;
@chunk char NoMonkeyError[] = "FTPOOMM failed: No monkey present. Acquire a monkey and try again.";
@chunk char NoPeanutError[] = "FTPOOMM failed: No peanuts present. Please insert peanuts and try again.";
@end ErrorStrings;
When working with assembly language, this means that any object stored in a
code
resource,
idata
, or
udata
will be passed over in the search for localizable resources, and thus will not be localizable.
When you know you are storing your strings such that they are localizable, you can provide information which will be visible to the translator when they use the
ResEdit
tool. Use the
@localize
keyword (
localize
in assembly) to set up this help text. The
@localize
directive should directly follow the chunk it applies to.
Remember the
@localize
syntax:
@localize { <string> <min>-<max> };
@localize { <string> <length> };
@localize { <string> };
@localize <string>;
@localize not;
Code Display 8-2 Storing Strings in Localizable Resources
@start ErrorStrings, data
@chunk char NoMonkeyError[] = "FTPOOMM failed: No monkey present. Acquire a monkey and try again";
@localize "The phrase 'acquire a monkey' appears in another string. Both should \ be translated in the same way.";
@end ErrorStrings
@object GenGlyphClass BossMon = {
GI_visMoniker = "Boss";
@localize { "This means hide the game because a boss is coming" 3-6 }; }
Another thing to keep in mind is that when strings are translated, they are likely to grow 33% to 50%. You have to remember to leave room for larger strings, both in memory and in UI. If you use the usual generic UI gadgetry, the geometry manager should stretch the various gadgets to fit any larger names. You should be careful that it doesn't have to stretch so far that components get lost off the edge of the screen. If you decide to get around this problem by constraining the size of some gadgetry, keep in mind that if you don't allow it to stretch, your new strings may not fit.
GEOS SDK TechDocs
|
|
2 How To Use Localization
|
4 International Formats