@@ -52,10 +52,25 @@ local du = require "lib/dtutils"
52
52
53
53
du .check_min_api_version (" 7.0.0" , " LabelsToTags" )
54
54
55
+ local gettext = darktable .gettext .gettext
56
+
57
+ darktable .gettext .bindtextdomain (" LabelsToTags" , darktable .configuration .config_dir .. " /lua/locale/" )
58
+
59
+ local function _ (msgid )
60
+ return gettext (msgid )
61
+ end
62
+
55
63
-- return data structure for script_manager
56
64
57
65
local script_data = {}
58
66
67
+ script_data .metadata = {
68
+ name = " LabelsToTags" ,
69
+ purpose = _ (" allows the mass-application of tags using color labels and ratings as a guide" ),
70
+ author = " August Schwerdfeger ([email protected] )" ,
71
+ help = " https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/LabelsToTags"
72
+ }
73
+
59
74
script_data .destroy = nil -- function to destory the script
60
75
script_data .destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
61
76
script_data .restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
@@ -68,7 +83,7 @@ local ltt = {}
68
83
ltt .module_installed = false
69
84
ltt .event_registered = false
70
85
71
- local LIB_ID = " LabelsToTags"
86
+ local LIB_ID = _ ( " LabelsToTags" )
72
87
73
88
-- Helper functions: BEGIN
74
89
@@ -109,23 +124,23 @@ end
109
124
110
125
111
126
local initialAvailableMappings = {
112
- [" Colors " ] = { [" +*****" ] = { " Red " },
113
- [" *+****" ] = { " Yellow " },
114
- [" **+***" ] = { " Green " },
115
- [" ***+**" ] = { " Blue " },
116
- [" ****+*" ] = { " Purple " } },
117
- [" Single colors" ] = { [" +----*" ] = { " Red " , " Only red" },
118
- [" -+---*" ] = { " Yellow" , " Only yellow" },
119
- [" --+--*" ] = { " Green" , " Only green" },
120
- [" ---+-*" ] = { " Blue" , " Only blue" },
121
- [" ----+*" ] = { " Purple" , " Only purple" } },
122
- [" Ratings " ] = { [" *****0" ] = { " No stars" , " Not rejected" },
123
- [" *****1" ] = { " One star" , " Not rejected" },
124
- [" *****2" ] = { " Two stars" , " Not rejected" },
125
- [" *****3" ] = { " Three stars" , " Not rejected" },
126
- [" *****4" ] = { " Four stars" , " Not rejected" },
127
- [" *****5" ] = { " Five stars" , " Not rejected" },
128
- [" *****R" ] = { " Rejected " } }
127
+ [_ ( " colors " ) ] = { [" +*****" ] = { _ ( " red " ) },
128
+ [" *+****" ] = { _ ( " yellow " ) },
129
+ [" **+***" ] = { _ ( " green " ) },
130
+ [" ***+**" ] = { _ ( " blue " ) },
131
+ [" ****+*" ] = { _ ( " purple " ) } },
132
+ [_ ( " single colors" ) ] = { [" +----*" ] = { _ ( " red " ), _ ( " only red" ) },
133
+ [" -+---*" ] = { _ ( " Yellow" ), _ ( " only yellow" ) },
134
+ [" --+--*" ] = { _ ( " Green" ), _ ( " only green" ) },
135
+ [" ---+-*" ] = { _ ( " Blue" ), _ ( " only blue" ) },
136
+ [" ----+*" ] = { _ ( " Purple" ), _ ( " only purple" ) } },
137
+ [_ ( " ratings " ) ] = { [" *****0" ] = { _ ( " no stars" ), _ ( " not rejected" ) },
138
+ [" *****1" ] = { _ ( " one star" ), _ ( " not rejected" ) },
139
+ [" *****2" ] = { _ ( " two stars" ), _ ( " not rejected" ) },
140
+ [" *****3" ] = { _ ( " three stars" ), _ ( " not rejected" ) },
141
+ [" *****4" ] = { _ ( " four stars" ), _ ( " not rejected" ) },
142
+ [" *****5" ] = { _ ( " five stars" ), _ ( " not rejected" ) },
143
+ [" *****R" ] = { _ ( " rejected " ) } }
129
144
}
130
145
131
146
local availableMappings = {}
@@ -140,14 +155,14 @@ end
140
155
141
156
local function getComboboxTooltip ()
142
157
if availableMappings == nil or next (availableMappings ) == nil then
143
- return (" No registered mappings -- using defaults" )
158
+ return (_ ( " no registered mappings -- using defaults" ) )
144
159
else
145
- return (" Select a label-to-tag mapping" )
160
+ return (_ ( " select a label-to-tag mapping" ) )
146
161
end
147
162
end
148
163
149
164
local mappingComboBox = darktable .new_widget (" combobox" ){
150
- label = " mapping" ,
165
+ label = _ ( " mapping" ) ,
151
166
value = 1 ,
152
167
tooltip = getComboboxTooltip (),
153
168
reset_callback = function (selfC )
@@ -170,7 +185,7 @@ local mappingComboBox = darktable.new_widget("combobox"){
170
185
}
171
186
172
187
local function doTagging (selfC )
173
- local job = darktable .gui .create_job (string.format (" labels to tags (%d image" .. (# (darktable .gui .action_images ) == 1 and " " or " s" ) .. " ) " , # ( darktable . gui . action_images )), true )
188
+ local job = darktable .gui .create_job (string.format (_ ( " labels to tags (%d image%s) " ), # ( darktable . gui . action_images ), (# (darktable .gui .action_images ) == 1 and " " or " s" )), true )
174
189
job .percent = 0.0
175
190
local pctIncrement = 1.0 / # (darktable .gui .action_images )
176
191
0 commit comments