Locale Names; Testing Localization - Adobe 27510753 - InDesign CS2 - PC Manual

Scripting guide
Hide thumbs Also See for 27510753 - InDesign CS2 - PC:
Table of Contents

Advertisement

62
Using ExtendScript Tools and Features

Locale names

A locale name is an identifier string in that contains an ISO 639 language specifier, and optionally an ISO 3166
region specifier, separated from the language specifier by an underscore.
The ISO 639 standard defines a set of two-letter language abbreviations, such as en for English and de for
l
German.
The ISO 3166 standard defines a region code, another two-letter identifier, which you can optionally ap-
l
pend to the language identifier with an underscore. For example, en _ US identifies U.S. English, while
en _ GB
This object defines one message for British English, another for all other flavors of English, and another for all
flavors of German:
message = {
en_GB: "Please select a colour."
en: "Please select a colour."
de: "Bitte wählen Sie eine Farbe."
};
If you need to specify different messages for different platforms, you can append another underline character
and the name of the platform, one of Win , Mac , or Unix . For example, this objects defines one message in
British English to be displayed in Mac OS, one for all other flavors of English in Mac OS, and one for all other
flavors of English on all other platforms:
pressMsg = {
en_GB_Mac: "Press Cmd-S to select a colour.",
en_Mac: "Press Cmd-S to select a color.",
en: "Press Ctrl-S to select a color."
};
All of these identifiers are case sensitive. For example, EN _ US is not valid.
How locale names are resolved
1. ExtendScript gets the hosting application's locale; for example, en _ US .
2. It appends the platform identifier; for example, en _ US _ Win .
3. It looks for a matching property, and if found, returns the value string.
4. If not found, it removes the platform identifier (for example, en _ US ) and retries .
5. If not found, it removes the region identifier (for example, en ) and retries .
6. If not found, it tries the identifier en (that is, the default language is English).
7. If not found, it returns the entire localizer object.

Testing localization

ExtendScript stores the current locale in the variable $.locale . This variable is updated whenever the locale
of the hosting application changes.
To test your localized strings, you can temporarily reset the locale. To restore the original behavior, set the
variable to null , false , 0, or the empty string. An example:
$.locale = "ru"; // try your Russian messages
$.locale = null; // restore to the locale of the app
identifies British English.
Adobe InDesign CS2 Scripting Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs2

Table of Contents