Adobe 65007312 Programming Guide - Page 26

The loader environment, Using ZStrings for Localization

Page 26 highlights

CHAPTER 2: Writing a Lightroom Plug-in Writing standard plug-ins for Lightroom 26 LrMetadataProvider Optional table of tables Adds custom metadata fields, available only in Lightroom. There can be only one such item in a plug-in. It contains a string, the name of the Lua file (metadata definition script) that defines the fields. See "Adding custom metadata" on page 68. Can be combined with other services (export services, export filters) or can be the only service provided by the plug-in. Ignored in any Lightroom version older than 2.0. LrMetadataTagsetFactory Optional table of tables Adds a tagset of predefined metadata fields. The user can select defined metadata tagsets from a menu in the Metadata panel. Some tagsets are supplied by Lightroom; this allows your plug-in to supply additional tagsets. See "Adding custom metadata tagsets" on page 73. Ignored in any Lightroom version older than 2.0. LrAlsoUseBuiltInTransla- Optional tions Boolean Controls behavior of built-in LOC function. When true, strings that are not found in the plug-in's translation file are checked against Lightroom's translation file for the current language. Note that string keys are not guaranteed to remain the same across version releases. Ignored in any Lightroom version older than 3.0. The loader environment The Info.lua file is a special Lua environment that is much more restrictive than the general SDK Lua environment in which other scripts run. X The standard Lua namespace string is available, and you can use the LOC function for localization of display strings in this file (see Chapter 7, "Using ZStrings for Localization"). X You can use WIN_ENV and MAC_ENV environment variables, and the _VERSION variable that contains most of the version information otherwise available through LrApplication.versionTable(). However, you cannot use any of the other Lua or Lightroom globals defined in the SDK scripting environment, (see "The Lightroom SDK scripting environment" on page 12). For example, you cannot use import or require in this context. Here is an example of an Info.lua file for a plug-in that adds items to the Lightroom menus: return { LrSdkVersion = 3.0, LrSdkMinimumVersion = 1.3, -- minimum SDK version required by this plug-in LrToolkitIdentifier = 'com.adobe.lightroom.sdk.helloworld', LrPluginName = LOC "$$$/HelloWorld/PluginName=Hello World Sample", -- Add the menu item to the File menu.

  • 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
2: Writing a Lightroom Plug-in
Writing standard plug-ins for Lightroom
26
The loader environment
The
Info.lua
file is a special Lua environment that is much more restrictive than the general SDK Lua
environment in which other scripts run.
X
The standard Lua namespace
string
is available, and you can use the
LOC
function for localization of
display strings in this file (see
Chapter 7, “Using ZStrings for Localization
“).
X
You can use
WIN_ENV
and
MAC_ENV
environment variables, and the
_VERSION
variable that contains
most of the version information otherwise available through
LrApplication.versionTable()
.
However, you cannot use any of the other Lua or Lightroom globals defined in the SDK scripting
environment, (see
“The Lightroom SDK scripting environment” on page 12
). For example, you cannot use
import
or
require
in this context.
Here is an example of an
Info.lua
file for a plug-in that adds items to the Lightroom menus:
return {
LrSdkVersion = 3.0,
LrSdkMinimumVersion = 1.3, -- minimum SDK version required by this plug-in
LrToolkitIdentifier = 'com.adobe.lightroom.sdk.helloworld',
LrPluginName = LOC "$$$/HelloWorld/PluginName=Hello World Sample",
-- Add the menu item to the File menu.
LrMetadataProvider
Optional
table of
tables
Adds custom metadata fields, available only in Lightroom.
There can be only one such item in a plug-in. It contains a
string, the name of the Lua file (
metadata definition script
)
that defines the fields. See
“Adding custom metadata” on
page 68
.
Can be combined with other services (export services,
export filters) or can be the only service provided by the
plug-in.
Ignored in any Lightroom version older than 2.0.
LrMetadataTagsetFactory
Optional
table of
tables
Adds a tagset of predefined metadata fields. The user can
select defined metadata tagsets from a menu in the
Metadata panel. Some tagsets are supplied by Lightroom;
this allows your plug-in to supply additional tagsets. See
“Adding custom metadata tagsets” on page 73
.
Ignored in any Lightroom version older than 2.0.
LrAlsoUseBuiltInTransla-
tions
Optional
Boolean
Controls behavior of built-in LOC function. When true,
strings that are not found in the plug-in’s translation file are
checked against Lightroom’s translation file for the current
language.
Note that string keys are not guaranteed to remain the
same across version releases.
Ignored in any Lightroom version older than 3.0.