Skip to content

Commit ac945b9

Browse files
authored
Merge pull request #455 from wpferguson/prep_translation
Prepare translatable strings, step 1
2 parents ebd2cd7 + cd3788f commit ac945b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+639
-642
lines changed

contrib/AutoGrouper.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
5252
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
5353
script_data.show = nil -- only required for libs since the destroy_method only hides them
5454

55-
local gettext = dt.gettext
56-
-- Tell gettext where to find the .mo file translating messages for a particular domain
57-
gettext.bindtextdomain("AutoGrouper",dt.configuration.config_dir.."/lua/locale/")
55+
local gettext = dt.gettext.gettext
56+
gettext.bindtextdomain(MOD, dt.configuration.config_dir .."/lua/locale/")
5857

5958
local function _(msgid)
60-
return gettext.dgettext("AutoGrouper", msgid)
59+
return gettext(msgid)
6160
end
6261

6362
local Ag = {}

contrib/CollectHelper.lua

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,10 @@ In the "Selected Images" module click on "Collect on this Image"
4747

4848
local dt = require "darktable"
4949
local du = require "lib/dtutils"
50-
local gettext = dt.gettext
50+
local gettext = dt.gettext.gettext
5151
local previous = nil
5252
local all_active = false
5353

54-
-- Tell gettext where to find the .mo file translating messages for a particular domain
55-
gettext.bindtextdomain("CollectHelper",dt.configuration.config_dir.."/lua/locale/")
56-
5754
du.check_min_api_version("7.0.0", "CollectHelper")
5855

5956
-- return data structure for script_manager
@@ -65,14 +62,16 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
6562
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
6663
script_data.show = nil -- only required for libs since the destroy_method only hides them
6764

65+
gettext.bindtextdomain("CollectHelper", dt.configuration.config_dir .."/lua/locale/")
66+
6867
local function _(msgid)
69-
return gettext.dgettext("CollectHelper", msgid)
68+
return gettext(msgid)
7069
end
7170

7271
-- FUNCTION --
7372
local function CheckSingleImage(selection)
7473
if #selection ~= 1 then
75-
dt.print(_("Please select a single image"))
74+
dt.print(_("please select a single image"))
7675
return true
7776
end
7877
return false
@@ -205,47 +204,47 @@ end
205204
dt.gui.libs.image.register_action(
206205
"CollectHelper_prev", _("collect: previous"),
207206
function() PreviousCollection() end,
208-
_("Sets the Collect parameters to be the previously active parameters")
207+
_("sets the collect parameters to be the previously active parameters")
209208
)
210209
if dt.preferences.read('module_CollectHelper','folder','bool') then
211210
dt.gui.libs.image.register_action(
212211
"CollectHelper_folder", _("collect: folder"),
213212
function() CollectOnFolder(_ , false) end,
214-
_("Sets the Collect parameters to be the selected images's folder")
213+
_("sets the collect parameters to be the selected images's folder")
215214
)
216215
end
217216
if dt.preferences.read('module_CollectHelper','colors','bool') then
218217
dt.gui.libs.image.register_action(
219218
"CollectHelper_labels", _("collect: color label(s)"),
220219
function() CollectOnColors(_ , false) end,
221-
_("Sets the Collect parameters to be the selected images's color label(s)")
220+
_("sets the collect parameters to be the selected images's color label(s)")
222221
)
223222
end
224223
if dt.preferences.read('module_CollectHelper','all_and','bool') then
225224
dt.gui.libs.image.register_action(
226225
"CollectHelper_and", _("collect: all (AND)"),
227226
function() CollectOnAll_AND() end,
228-
_("Sets the Collect parameters based on all activated CollectHelper options")
227+
_("sets the collect parameters based on all activated CollectHelper options")
229228
)
230229
end
231230

232231
-- PREFERENCES --
233232
dt.preferences.register("module_CollectHelper", "all_and", -- name
234233
"bool", -- type
235-
_('CollectHelper: All'), -- label
236-
_('Will create a collect parameter set that utilizes all enabled CollectHelper types (AND)'), -- tooltip
234+
_('CollectHelper: all'), -- label
235+
_('will create a collect parameter set that utilizes all enabled CollectHelper types (and)'), -- tooltip
237236
true -- default
238237
)
239238
dt.preferences.register("module_CollectHelper", "colors", -- name
240239
"bool", -- type
241-
_('CollectHelper: Color Label(s)'), -- label
242-
_('Enable the button that allows you to swap to a collection based on selected image\'s COLOR LABEL(S)'), -- tooltip
240+
_('CollectHelper: color label(s)'), -- label
241+
_('enable the button that allows you to swap to a collection based on selected image\'s color label(s)'), -- tooltip
243242
true -- default
244243
)
245244
dt.preferences.register("module_CollectHelper", "folder", -- name
246245
"bool", -- type
247-
_('CollectHelper: Folder'), -- label
248-
_('Enable the button that allows you to swap to a collection based on selected image\'s FOLDER location'), -- tooltip
246+
_('CollectHelper: folder'), -- label
247+
_('enable the button that allows you to swap to a collection based on selected image\'s folder location'), -- tooltip
249248
true -- default
250249
)
251250

contrib/HDRMerge.lua

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ if dt.configuration.running_os == 'windows' then os_path_seperator = '\\' end
6767
local CURR_API_STRING = dt.configuration.api_version_string
6868

6969
-- Tell gettext where to find the .mo file translating messages for a particular domain
70-
local gettext = dt.gettext
71-
gettext.bindtextdomain('HDRMerge', dt.configuration.config_dir..'/lua/locale/')
70+
local gettext = dt.gettext.gettext
71+
72+
gettext.bindtextdomain("HDRMerge", dt.configuration.config_dir .."/lua/locale/")
73+
7274
local function _(msgid)
73-
return gettext.dgettext('HDRMerge', msgid)
75+
return gettext(msgid)
7476
end
7577

7678
local temp
@@ -208,7 +210,7 @@ end
208210
local function main()
209211
PreCall({HDRM}) --check if furst run then check if install OK
210212
if HDRM.install_error then
211-
dt.print_error(_('HDRMerge install issue'))
213+
dt.print_error('HDRMerge install issue')
212214
dt.print(_('HDRMerge install issue, please ensure the binary path is proper'))
213215
return
214216
end
@@ -277,7 +279,7 @@ local function main()
277279
end
278280
dt.print(_('HDRMerge completed successfully'))
279281
else
280-
dt.print_error(_('HDRMerge failed'))
282+
dt.print_error('HDRMerge failed')
281283
dt.print(_('HDRMerge failed'))
282284
end
283285

@@ -378,7 +380,7 @@ local lbl_import = dt.new_widget('section_label'){
378380
}
379381
GUI.Target.style = dt.new_widget('combobox'){
380382
label = _('apply style on import'),
381-
tooltip = _('Apply selected style on auto-import to newly created image'),
383+
tooltip = _('apply selected style on auto-import to newly created image'),
382384
selected = 1,
383385
_('none'),
384386
changed_callback = function(self)
@@ -407,9 +409,9 @@ GUI.Target.copy_tags = dt.new_widget('check_button'){
407409
temp = dt.preferences.read(mod, 'active_add_tags', 'string')
408410
if temp == '' then temp = nil end
409411
GUI.Target.add_tags = dt.new_widget('entry'){
410-
tooltip = _('Additional tags to be added on import. Seperate with commas, all spaces will be removed'),
412+
tooltip = _('additional tags to be added on import, seperate with commas, all spaces will be removed'),
411413
text = temp,
412-
placeholder = _('Enter tags, seperated by commas'),
414+
placeholder = _('enter tags, seperated by commas'),
413415
editable = true
414416
}
415417
GUI.run = dt.new_widget('button'){
@@ -418,7 +420,7 @@ GUI.run = dt.new_widget('button'){
418420
clicked_callback = function() main() end
419421
}
420422
GUI.exes.HDRMerge = dt.new_widget('file_chooser_button'){
421-
title = _('Select HDRmerge executable'),
423+
title = _('select HDRmerge executable'),
422424
value = df.get_executable_path_preference(HDRM.name),
423425
is_directory = false
424426
}

contrib/LabelsToTags.lua

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ local du = require "lib/dtutils"
5252

5353
du.check_min_api_version("7.0.0", "LabelsToTags")
5454

55+
local gettext = dt.gettext.gettext
56+
57+
gettext.bindtextdomain("LabelsToTags", dt.configuration.config_dir .."/lua/locale/")
58+
59+
local function _(msgid)
60+
return gettext(msgid)
61+
end
62+
5563
-- return data structure for script_manager
5664

5765
local script_data = {}
@@ -68,7 +76,7 @@ local ltt = {}
6876
ltt.module_installed = false
6977
ltt.event_registered = false
7078

71-
local LIB_ID = "LabelsToTags"
79+
local LIB_ID = _("LabelsToTags")
7280

7381
-- Helper functions: BEGIN
7482

@@ -109,23 +117,23 @@ end
109117

110118

111119
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" } }
120+
[_("colors")] = { ["+*****"] = { _("red") },
121+
["*+****"] = { _("yellow") },
122+
["**+***"] = { _("green") },
123+
["***+**"] = { _("blue") },
124+
["****+*"] = { _("purple") } },
125+
[_("single colors")] = { ["+----*"] = { _("red"), _("only red") },
126+
["-+---*"] = { _("Yellow"), _("only yellow") },
127+
["--+--*"] = { _("Green"), _("only green") },
128+
["---+-*"] = { _("Blue"), _("only blue") },
129+
["----+*"] = { _("Purple"), _("only purple") } },
130+
[_("ratings")] = { ["*****0"] = { _("no stars"), _("not rejected") },
131+
["*****1"] = { _("one star"), _("not rejected") },
132+
["*****2"] = { _("two stars"), _("not rejected") },
133+
["*****3"] = { _("three stars"), _("not rejected") },
134+
["*****4"] = { _("four stars"), _("not rejected") },
135+
["*****5"] = { _("five stars"), _("not rejected") },
136+
["*****R"] = { _("rejected") } }
129137
}
130138

131139
local availableMappings = {}
@@ -140,14 +148,14 @@ end
140148

141149
local function getComboboxTooltip()
142150
if availableMappings == nil or next(availableMappings) == nil then
143-
return("No registered mappings -- using defaults")
151+
return(_("no registered mappings -- using defaults"))
144152
else
145-
return("Select a label-to-tag mapping")
153+
return(_("select a label-to-tag mapping"))
146154
end
147155
end
148156

149157
local mappingComboBox = darktable.new_widget("combobox"){
150-
label = "mapping",
158+
label = _("mapping"),
151159
value = 1,
152160
tooltip = getComboboxTooltip(),
153161
reset_callback = function(selfC)
@@ -170,7 +178,7 @@ local mappingComboBox = darktable.new_widget("combobox"){
170178
}
171179

172180
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)
181+
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)
174182
job.percent = 0.0
175183
local pctIncrement = 1.0 / #(darktable.gui.action_images)
176184

contrib/OpenInExplorer.lua

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ local dt = require "darktable"
5151
local du = require "lib/dtutils"
5252
local df = require "lib/dtutils.file"
5353
local dsys = require "lib/dtutils.system"
54-
local gettext = dt.gettext
54+
local gettext = dt.gettext.gettext
5555

5656
--Check API version
5757
du.check_min_api_version("7.0.0", "OpenInExplorer")
@@ -65,19 +65,18 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
6565
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
6666
script_data.show = nil -- only required for libs since the destroy_method only hides them
6767

68-
-- Tell gettext where to find the .mo file translating messages for a particular domain
69-
gettext.bindtextdomain("OpenInExplorer",dt.configuration.config_dir.."/lua/locale/")
68+
gettext.bindtextdomain("OpenInExplorer", dt.configuration.config_dir .."/lua/locale/")
7069

7170
local function _(msgid)
72-
return gettext.dgettext("OpenInExplorer", msgid)
71+
return gettext(msgid)
7372
end
7473

7574
local act_os = dt.configuration.running_os
7675
local PS = act_os == "windows" and "\\" or "/"
7776

7877
--Detect OS and quit if it is not supported.
7978
if act_os ~= "macos" and act_os ~= "windows" and act_os ~= "linux" then
80-
dt.print(_("OpenInExplorer plug-in only supports Linux, macOS, and Windows at this time"))
79+
dt.print(_("OpenInExplorer plug-in only supports linux, macos, and windows at this time"))
8180
dt.print_error("OpenInExplorer plug-in only supports Linux, macOS, and Windows at this time")
8281
return
8382
end
@@ -93,11 +92,11 @@ local function check_if_links_dir_exists()
9392
local dir_exists = true
9493
if not links_dir then
9594
--Just for paranoic reasons. I tried, but I couldn't devise a setting for a nil value.
96-
dt.print(_("No links directory selected.\nPlease check the dt preferences (lua options)"))
95+
dt.print(_("no links directory selected\nplease check the dt preferences (lua options)"))
9796
dt.print_error("OpenInExplorer: No links directory selected")
9897
dir_exists = false
9998
elseif not df.check_if_file_exists(links_dir) then
100-
dt.print(string.format(_("Links directory '%s' not found.\nPlease check the dt preferences (lua options)"), links_dir))
99+
dt.print(string.format(_("links directory '%s' not found\nplease check the dt preferences (lua options)"), links_dir))
101100
dt.print_error(string.format("OpenInExplorer: Links directory '%s' not found", links_dir))
102101
dir_exists = false
103102
end
@@ -154,7 +153,7 @@ local function set_links(selected_images)
154153
end
155154
]]
156155
if dsys.external_command(run_cmd) ~= 0 then
157-
dt.print(_("Failed to create links. Missing rights?"))
156+
dt.print(_("failed to create links, missing rights?"))
158157
dt.print_error("OpenInExplorer: Failed to create links")
159158
return
160159
end
@@ -170,13 +169,13 @@ end
170169
local function open_in_fmanager()
171170
local images = dt.gui.selection()
172171
if #images == 0 then
173-
dt.print(_("Please select an image"))
172+
dt.print(_("please select an image"))
174173
else
175174
if use_links and not check_if_links_dir_exists() then
176175
return
177176
end
178177
if #images > 15 and not use_links then
179-
dt.print(_("Please select fewer images (max. 15)"))
178+
dt.print(_("please select fewer images (max. 15)"))
180179
elseif use_links then
181180
set_links(images)
182181
else
@@ -203,25 +202,25 @@ end
203202
dt.gui.libs.image.register_action(
204203
"OpenInExplorer", _("show in file explorer"),
205204
function() open_in_fmanager() end,
206-
_("Open the file manager at the selected image's location")
205+
_("open the file manager at the selected image's location")
207206
)
208207

209208

210209
if act_os ~= "windows" then
211210
dt.preferences.register("OpenInExplorer", "linked_image_files_dir", -- name
212211
"directory", -- type
213212
_("OpenInExplorer: linked files directory"), -- label
214-
_("Directory to store the links to the file names. Requires restart to take effect"), -- tooltip
213+
_("directory to store the links to the file names, requires restart to take effect"), -- tooltip
215214
"Links to image files", -- default
216215
dt.new_widget("file_chooser_button"){
217-
title = _("Select directory"),
216+
title = _("select directory"),
218217
is_directory = true,
219218
}
220219
)
221220
dt.preferences.register("OpenInExplorer", "use_links", -- name
222221
"bool", -- type
223222
_("OpenInExplorer: use links"), -- label
224-
_("Use links instead of multiple windows. Requires restart to take effect"), -- tooltip
223+
_("use links instead of multiple windows, requires restart to take effect"), -- tooltip
225224
false, -- default
226225
""
227226
)

contrib/RL_out_sharp.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ script_data.show = nil -- only required for libs since the destroy_method only h
7878
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
7979

8080
-- translation
81-
local gettext = dt.gettext
82-
gettext.bindtextdomain(MODULE_NAME, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
81+
local gettext = dt.gettext.gettext
82+
83+
gettext.bindtextdomain("RL_out_sharp", dt.configuration.config_dir .."/lua/locale/")
84+
8385
local function _(msgid)
84-
return gettext.dgettext(MODULE_NAME, msgid)
86+
return gettext(msgid)
8587
end
8688

8789
-- initialize module preferences
@@ -137,7 +139,7 @@ local function export2RL(storage, image_table, extra_data)
137139
for image, temp_name in pairs(image_table) do
138140

139141
i = i + 1
140-
dt.print(_("sharpening image ")..i.." ...")
142+
dt.print(string.format(_("sharpening image %d ..."), i))
141143
-- create unique filename
142144
new_name = output_folder..PS..df.get_basename(temp_name)..".jpg"
143145
new_name = df.create_unique_filename(new_name)

0 commit comments

Comments
 (0)