Adobe 65007312 Programming Guide - Page 148

Localization dictionary files

Page 148 highlights

CHAPTER 7: Using ZStrings for Localization Localization dictionary files 148 Localization dictionary files To localize your plug-in's user interface, you must provide a localization dictionary file for each language, named and located as follows: X Each translation dictionary must be in a file named TranslatedStrings_code.txt. The code is the two-letter ISO code for the language, such as en for English, fr for French, de for German, ja for Japanese, and so on. X The dictionary files must located be in the top plug-in folder, with the Info.lua file. Lightroom automatically selects the appropriate translation file based on the current language in use for the application. Lightroom performs ZString translation when it creates the object containing the string. When the LOC function encounters a ZString, it looks for the localization dictionary appropriate to the current locale, and uses it to find translations for static ZString values. X If there are no localization dictionary files, or if none is found to match the application language, the LOC function returns the value string found in the original ZString. X When it does find a matching dictionary file, the LOC function locates the ZString in the dictionary file using the context path and property name; that is, the first part of the supplied ZString up to, but not including the = sign. If a matching line is found, LOC removes the first part of the found ZString up to and including the = sign, and returns the remaining string as the translation. X If a matching line is not found in the dictionary, the function returns the value string found in the original ZString. Localization dictionary file format A localization dictionary file is a text file containing one ZString translation entry per line. Each ZString's final string value is in the destination language. The text must be encoded in UTF-8. The only things allowed on a line (after the first character) are ZStrings; no newline characters or comments are allowed. The ZStrings in this file must all be enclosed with double quotes. The following text editors are recommended for creating these files: X In Mac OS X simply use TextEdit and make sure you save the file type as "UTF-8" (rather than UTF-16 or UCS-2, for instance). X In Windows use Notepad, and be sure to save the file as type "UTF-8." The file is UTF-8 formatted text. A leading UTF-8 byte-order marker (EF BB BF) is permitted.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204

C
HAPTER
7: Using ZStrings for Localization
Localization dictionary files
148
Localization dictionary files
To localize your plug-in’s user interface, you must provide a localization dictionary file for each language,
named and located as follows:
X
Each translation dictionary must be in a file named
TranslatedStrings_
code
.txt
. The
code
is the
two-letter ISO code for the language, such as
en
for English,
fr
for French,
de
for German,
ja
for
Japanese, and so on.
X
The dictionary files must located be in the top plug-in folder, with the
Info.lua
file.
Lightroom automatically selects the appropriate translation file based on the current language in use for
the application.
Lightroom performs ZString translation when it creates the object containing the string. When the
LOC
function encounters a ZString, it looks for the localization dictionary appropriate to the current locale, and
uses it to find translations for static ZString values.
X
If there are no localization dictionary files, or if none is found to match the application language, the
LOC
function returns the value string found in the original ZString.
X
When it does find a matching dictionary file, the
LOC
function locates the ZString in the dictionary file
using the
context path
and
property name
; that is, the first part of the supplied ZString up to, but not
including the
=
sign. If a matching line is found,
LOC
removes the first part of the found ZString up to
and including the
=
sign, and returns the remaining string as the translation.
X
If a matching line is not found in the dictionary, the function returns the value string found in the
original ZString.
Localization dictionary file format
A localization dictionary file is a text file containing one ZString translation entry per line. Each ZString’s
final string value is in the destination language. The text must be encoded in UTF-8.
The only things allowed on a line (after the first character) are ZStrings; no newline characters or
comments are allowed. The ZStrings in this file must all be enclosed with double quotes.
The following text editors are recommended for creating these files:
X
In Mac OS X simply use TextEdit and make sure you save the file type as “UTF-8” (rather than UTF-16 or
UCS-2, for instance).
X
In Windows use Notepad, and be sure to save the file as type “UTF-8.”
The file is UTF-8 formatted text. A leading UTF-8 byte-order marker (
EF BB BF
) is permitted.