1
1
--[[
2
2
This file is part of darktable,
3
- copyright 2014-2016 by Christian Kanzian.
3
+ Copyright 2014-2016 by Christian Kanzian
4
+ Copyright 2016 by Holger Klemm
4
5
5
6
This program is free software: you can redistribute it and/or modify
6
7
it under the terms of the GNU General Public License as published by
36
37
]]
37
38
38
39
local dt = require " darktable"
40
+ local gettext = dt .gettext
39
41
dt .configuration .check_version (... ,{3 ,0 ,0 },{4 ,0 ,0 })
40
42
43
+ -- Tell gettext where to find the .mo file translating messages for a particular domain
44
+ gettext .bindtextdomain (" copy_attach_detach_tags" ,dt .configuration .config_dir .. " /lua/" )
45
+
46
+ local function _ (msgid )
47
+ return gettext .dgettext (" copy_attach_detach_tags" , msgid )
48
+ end
49
+
50
+
41
51
local image_tags = {}
42
52
43
53
@@ -71,7 +81,7 @@ local function mcopy_tags()
71
81
end
72
82
end
73
83
74
- dt .print (" Image tags copied ..." )
84
+ dt .print (_ ( ' Image tags copied ...' ) )
75
85
76
86
-- create UI tag list
77
87
local taglist = " "
@@ -93,7 +103,7 @@ local function mcopy_tags()
93
103
local function attach_tags ()
94
104
95
105
if next (image_tags ) == nil then
96
- dt .print (" No tags to attached, please copy tags first." )
106
+ dt .print (_ ( ' No tags to attached, please copy tags first.' ) )
97
107
return true
98
108
end
99
109
@@ -117,7 +127,7 @@ local function attach_tags()
117
127
end
118
128
end
119
129
end
120
- dt .print (" Tags attached ..." )
130
+ dt .print (_ ( ' Tags attached ...' ) )
121
131
end
122
132
123
133
local function detach_tags ()
@@ -133,37 +143,37 @@ local function detach_tags()
133
143
end
134
144
end
135
145
end
136
- dt .print (" Tags removed from image(s)." )
146
+ dt .print (_ ( ' Tags removed from image(s).' ) )
137
147
end
138
148
139
149
local function replace_tags ()
140
150
detach_tags ()
141
151
attach_tags ()
142
- dt .print (" Tags replaced" )
152
+ dt .print (_ ( ' Tags replaced' ) )
143
153
end
144
154
145
155
-- create modul Tagging addons
146
156
taglist_label .reset_callback = mcopy_tags
147
157
148
158
-- create buttons and elements
149
159
local mc_button = dt .new_widget (" button" ) {
150
- label = " multi copy tags" ,
160
+ label = _ ( ' multi copy tags' ) ,
151
161
clicked_callback = mcopy_tags }
152
162
153
163
local p_button = dt .new_widget (" button" ) {
154
- label = " paste tags" ,
164
+ label = _ ( ' paste tags' ) ,
155
165
clicked_callback = attach_tags }
156
166
157
167
local rep_button = dt .new_widget (" button" ) {
158
- label = " replace tags" ,
168
+ label = _ ( ' replace tags' ) ,
159
169
clicked_callback = replace_tags }
160
170
161
171
local rem_button = dt .new_widget (" button" ) {
162
- label = " remove all tags" ,
172
+ label = _ ( ' remove all tags' ) ,
163
173
clicked_callback = detach_tags }
164
174
165
175
local taglabel = dt .new_widget (" label" ) {
166
- label = " tag clipboard" ,
176
+ label = _ ( ' tag clipboard' ) ,
167
177
selectable = false ,
168
178
ellipsize = " middle" ,
169
179
halign = " start" }
@@ -191,22 +201,22 @@ dt.register_lib("tagging_addon","Tagging addon",true,false,{
191
201
-- shortcut for copy
192
202
dt .register_event (" shortcut" ,
193
203
mcopy_tags ,
194
- " copy tags from selected image(s)" )
204
+ _ ( ' copy tags from selected image(s)' ) )
195
205
196
206
-- shortcut for attach
197
207
dt .register_event (" shortcut" ,
198
208
attach_tags ,
199
- " paste tags to selected image(s)" )
209
+ _ ( ' paste tags to selected image(s)' ) )
200
210
201
211
-- shortcut for detaching tags
202
212
dt .register_event (" shortcut" ,
203
213
detach_tags ,
204
- " remove tags from selected image(s)" )
214
+ _ ( ' remove tags from selected image(s)' ) )
205
215
206
216
-- shortcut for replace tags
207
217
dt .register_event (" shortcut" ,
208
218
replace_tags ,
209
- " replace tags from selected image(s)" )
219
+ _ ( ' replace tags from selected image(s)' ) )
210
220
211
221
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
212
222
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;
0 commit comments