Adobe 27510753 Scripting Guide - Page 70
Locale names, Testing localization, en _ US, en _ US _ Win, locale
![]() |
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 70 highlights
62 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide 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. l The ISO 639 standard defines a set of two-letter language abbreviations, such as en for English and de for German. l The ISO 3166 standard defines a region code, another two-letter identifier, which you can optionally ap- pend to the language identifier with an underscore. For example, en _ US identifies U.S. English, while en _ GB identifies British English. 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
![](/manual_guide/products/adobe-27510753-scripting-guide-5f6265c/70.png)