Skip to content

Commit e3c3d99

Browse files
author
Tino Mettler
committed
Make UI text elements translatable
1 parent a47de82 commit e3c3d99

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

contrib/website_gallery_export.lua

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ local df = require "lib/dtutils.file"
2828
local temp = dt.preferences.read('web_gallery', 'title', 'string')
2929
if temp == nil then temp = 'Darktable gallery' end
3030

31+
local function _(msgid)
32+
return dt.gettext.gettext(msgid)
33+
end
34+
3135
local title_widget = dt.new_widget("entry")
3236
{
3337
text = temp
@@ -38,8 +42,8 @@ if temp == nil then temp = '' end
3842

3943
local dest_dir_widget = dt.new_widget("file_chooser_button")
4044
{
41-
title = "select output folder",
42-
tooltip = "select output folder",
45+
title = _("select output folder"),
46+
tooltip = _("select output folder"),
4347
value = temp,
4448
is_directory = true,
4549
changed_callback = function(this) dt.preferences.write('web_gallery', 'destination_dir', 'string', this.value) end
@@ -48,9 +52,9 @@ local dest_dir_widget = dt.new_widget("file_chooser_button")
4852
local gallery_widget = dt.new_widget("box")
4953
{
5054
orientation=vertical,
51-
dt.new_widget("label"){label = "gallery title"},
55+
dt.new_widget("label"){label = _("gallery title")},
5256
title_widget,
53-
dt.new_widget("label"){label = "destination directory"},
57+
dt.new_widget("label"){label = _("destination directory")},
5458
dest_dir_widget
5559
}
5660

@@ -117,11 +121,11 @@ local function fill_gallery_table(images_ordered, images_table, title, dest_dir,
117121

118122
local images = {}
119123
local index = 1
120-
local job = dt.gui.create_job("exporting thumbnail images", true, stop_job)
124+
local job = dt.gui.create_job(_("exporting thumbnail images"), true, stop_job)
121125

122126
for i, image in pairs(images_ordered) do
123127
local filename = images_table[image]
124-
dt.print("exporting thumbnail image "..index.."/"..#images_ordered)
128+
dt.print(_("exporting thumbnail image ")..index.."/"..#images_ordered)
125129
write_image(image, dest_dir, filename)
126130

127131
if exiftool then
@@ -164,7 +168,7 @@ local function generate_javascript_gallery_object(gallery)
164168
end
165169

166170
local function write_javascript_file(gallery_table, dest_dir)
167-
dt.print("write JavaScript file")
171+
dt.print(_("write JavaScript file"))
168172
javascript_object = generate_javascript_gallery_object(gallery_table)
169173

170174
local fileOut, errr = io.open(dest_dir.."/images.js", 'w+')
@@ -177,7 +181,7 @@ local function write_javascript_file(gallery_table, dest_dir)
177181
end
178182

179183
local function copy_static_files(dest_dir)
180-
dt.print("copy static gallery files")
184+
dt.print(_("copy static gallery files"))
181185
gfsrc = dt.configuration.config_dir.."/lua/data/website_gallery"
182186
gfiles = {
183187
"index.html",
@@ -200,7 +204,7 @@ local function build_gallery(storage, images_table, extra_data)
200204

201205
local images_ordered = extra_data["images"] -- process images in the correct order
202206
local sizes = extra_data["sizes"]
203-
local title = "Darktable export"
207+
local title = _("Darktable export")
204208
if title_widget.text ~= "" then
205209
title = title_widget.text
206210
end
@@ -231,7 +235,7 @@ script_data.destroy = destroy
231235

232236
local function show_status(storage, image, format, filename,
233237
number, total, high_quality, extra_data)
234-
dt.print(string.format("export image %i/%i", number, total))
238+
dt.print(string.format(_("export image").."%i/%i", number, total))
235239
aspect = image.aspect_ratio
236240
-- calculate the size of the exported image and store it in extra_data
237241
-- to make it available in the finalize function

0 commit comments

Comments
 (0)