Namespace LrLocalization
A ZString uniquely identifies a string usage within an application, allowing you to provide different language versions of the string, depending on the locale. A ZString has this format:
"$$$/ZStringPath/StringKey=This is the English text value"
The ZString mechanism searches a string dictionary for the current locale, matching the path and identifier, then displays the language-specific text. You must supply translation dictionaries for supported languages as part of your plug-in. See the SDK Programmer's Guide for information on how to create translation dictionaries.
ZStrings in code should consist entirely of low-ASCII characters. The key should only contain characters in the set "a-ZA-Z0-9/". The value can contain any low-ASCII character.
ZStrings allow some common non-low-ASCII characters to be substituted for escape sequences in the strings. For example, the sequence ^C
includes the copyright symbol in that location in the resulting string. The escape character followed by a number (^1
) is a replacement point, that allows the sequence to be replaced by some other string supplied as an additional argument to LOC()
.
The following escape sequences are available:
^r
: carriage return^n
: line feed^B
: bullet^C
: copyright^D
: degree^I
: increment^R
: registered trademark^S
: n-ary summation^T
: trademark^!
: logical not^{
: left single quote^}
: right single quote^[
: left double quote^]
: right double quote^'
: apostrophe^.
: ellipsis ("...")^E
: Latin small e with acute accent^e
: Latin small e with circumflex^d
: Greek capital delta^L
: backslash (\)^V
: vertical bar (|)^#
: command key (in Mac OS only)^`
: accent grave ("`")^^
: circumflex ("^")
^0 - ^9
: Replacement point for string arguments.^U+1234
: Encodes any arbitrary Unicode character by its code point (represented here by "1234"). The code point must always be expressed as four hexadecimal digits.
Summary
Functions
- LOC( string, ... )
-
Finds a localized string by looking up the key in the dictionary for the current locale. This function is an alias for
LrLocalization.translateForPlugin()
, which automatically provides the toolkit ID for the current plug-in.First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. string
- (string) The ZString value.
- 2. ...
- placeholder values for substitutions ^1 through ^9
Return value
(string) The localized display string, if found. If no matching string is found for the current locale, returns the string value from the passed ZString. - LrLocalization.currentLanguage()
-
Retrieves the language that is currently in use for translation.
First supported in version 3.0 of the Lightroom SDK.
Return value
(string) The two-letter ISO code for the language currently in use. (such as 'en' for English, 'fr' for French). - LrLocalization.encodeUtf8Character( ch )
-
Converts a Unicode code point value into a UTF-8 string.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. ch
- (number) The Unicode code point number.
Return value
(string) The UTF-8 string corresponding to that code point. - LrLocalization.translateForPlugin( pluginId, string, ... )
-
Finds a localized string by looking up the key in the plug-in's dictionary for the current locale.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. pluginId
- (string) The identifying name for the plug-in. This is the value of the Lightroom-defined property key
LR_exportServiceProvider
. - 2. string
- (string) The ZString value.
- 3. ...
- placeholder values for substitutions ^1 through ^9
Return value
(string) The localized display string, if found. If no matching string is found for the current locale, returns the string value from the passed ZString.