Translating Javascript Strings; Localization Test Features - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
This pushbutton displays
Start søk
replacement value in the table.
The SDK removes all leading and trailing spaces from the messages, and the message comparison is
case-sensitive. For example, if the localization table defined "search" instead of "Search" as the string
to match, GoLive would find no match and would not translate the button's label.
When the GoLive SDK cannot find a translation for a string, it attempts to find the string within a database
of localized strings that GoLive provides. Thus, GoLive translates many commonly used strings
automatically, even when the module's localization table does not define localized versions of them.

Translating JavaScript strings

The
module
retrieves its return value from the module's localization table entry for the current language.
localString =
To create dynamically localized strings in JavaScript code, replace literal string values passed to methods
with calls to your extension module's localize method. The localized string return value becomes the
argument to the method. Get a reference to the
variable.
For example, to present a confirmation dialog that GoLive localizes dynamically, your JavaScript code can
call the confirm global function with a localized argument string:
if (confirm (module.localize ("Are you sure?"))) ...
Using the example localization table, this code would display a confirmation dialog that prompts the user
with "Sind Sie sich sicher?" when running on a German version of GoLive.

Localization test features

An extension's JavaScript code can retrieve the current country code from the
property:
var currLocale = module.locale;
The locale property is read/write, but assigning a different country code to this property only changes
the behavior of the localize method within the affected module—it does not change the contents of
menus and dialogs.
For testing purposes, a module can override the current locale ID by specifying the value of the locale
attribute of the <jsxmodule> tag. The country code set by this attribute is valid for all of that module's
menus, dialogs, and messages.
To disable dynamic localization temporarily for testing purposes, specify NONE as the value of the locale
attribute of the <jsxmodule> tag.
Note:
Commercial products must not rely on this feature as a means of disabling localization.
For code examples that demonstrate dynamic localization features, see the Custom Box and Menus and
Dialogs samples that the SDK provides.
Suchen
when running on a Norwegian version of GoLive. If it is running in French, it does not find a
Object's
localize
moduleObject
Adobe GoLive CS2 SDK
as its label when running on a German version of GoLive, but it displays
method returns a localized version of the string passed as its argument. It
EnglishStringToLocalize
.localize (
module Object
Localization and Translation
);
for your extension from the
module
152
module
global
Object's
locale

Advertisement

Table of Contents
loading

Table of Contents