Merge pull request #455 from wpferguson/prep_translation

Prepare translatable strings, step 1
This commit is contained in:
wpferguson
2024-05-15 15:18:11 -04:00
committed by GitHub
64 changed files with 640 additions and 643 deletions

View File

@@ -52,12 +52,11 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local gettext = dt.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("AutoGrouper",dt.configuration.config_dir.."/lua/locale/")
local gettext = dt.gettext.gettext
gettext.bindtextdomain(MOD, dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("AutoGrouper", msgid)
return gettext(msgid)
end
local Ag = {}

View File

@@ -47,13 +47,10 @@ In the "Selected Images" module click on "Collect on this Image"
local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
local previous = nil
local all_active = false
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("CollectHelper",dt.configuration.config_dir.."/lua/locale/")
du.check_min_api_version("7.0.0", "CollectHelper")
-- 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
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
gettext.bindtextdomain("CollectHelper", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("CollectHelper", msgid)
return gettext(msgid)
end
-- FUNCTION --
local function CheckSingleImage(selection)
if #selection ~= 1 then
dt.print(_("Please select a single image"))
dt.print(_("please select a single image"))
return true
end
return false
@@ -205,47 +204,47 @@ end
dt.gui.libs.image.register_action(
"CollectHelper_prev", _("collect: previous"),
function() PreviousCollection() end,
_("Sets the Collect parameters to be the previously active parameters")
_("sets the collect parameters to be the previously active parameters")
)
if dt.preferences.read('module_CollectHelper','folder','bool') then
dt.gui.libs.image.register_action(
"CollectHelper_folder", _("collect: folder"),
function() CollectOnFolder(_ , false) end,
_("Sets the Collect parameters to be the selected images's folder")
_("sets the collect parameters to be the selected images's folder")
)
end
if dt.preferences.read('module_CollectHelper','colors','bool') then
dt.gui.libs.image.register_action(
"CollectHelper_labels", _("collect: color label(s)"),
function() CollectOnColors(_ , false) end,
_("Sets the Collect parameters to be the selected images's color label(s)")
_("sets the collect parameters to be the selected images's color label(s)")
)
end
if dt.preferences.read('module_CollectHelper','all_and','bool') then
dt.gui.libs.image.register_action(
"CollectHelper_and", _("collect: all (AND)"),
function() CollectOnAll_AND() end,
_("Sets the Collect parameters based on all activated CollectHelper options")
_("sets the collect parameters based on all activated CollectHelper options")
)
end
-- PREFERENCES --
dt.preferences.register("module_CollectHelper", "all_and", -- name
"bool", -- type
_('CollectHelper: All'), -- label
_('Will create a collect parameter set that utilizes all enabled CollectHelper types (AND)'), -- tooltip
_('CollectHelper: all'), -- label
_('will create a collect parameter set that utilizes all enabled CollectHelper types (and)'), -- tooltip
true -- default
)
dt.preferences.register("module_CollectHelper", "colors", -- name
"bool", -- type
_('CollectHelper: Color Label(s)'), -- label
_('Enable the button that allows you to swap to a collection based on selected image\'s COLOR LABEL(S)'), -- tooltip
_('CollectHelper: color label(s)'), -- label
_('enable the button that allows you to swap to a collection based on selected image\'s color label(s)'), -- tooltip
true -- default
)
dt.preferences.register("module_CollectHelper", "folder", -- name
"bool", -- type
_('CollectHelper: Folder'), -- label
_('Enable the button that allows you to swap to a collection based on selected image\'s FOLDER location'), -- tooltip
_('CollectHelper: folder'), -- label
_('enable the button that allows you to swap to a collection based on selected image\'s folder location'), -- tooltip
true -- default
)

View File

@@ -67,10 +67,12 @@ if dt.configuration.running_os == 'windows' then os_path_seperator = '\\' end
local CURR_API_STRING = dt.configuration.api_version_string
-- Tell gettext where to find the .mo file translating messages for a particular domain
local gettext = dt.gettext
gettext.bindtextdomain('HDRMerge', dt.configuration.config_dir..'/lua/locale/')
local gettext = dt.gettext.gettext
gettext.bindtextdomain("HDRMerge", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext('HDRMerge', msgid)
return gettext(msgid)
end
local temp
@@ -208,7 +210,7 @@ end
local function main()
PreCall({HDRM}) --check if furst run then check if install OK
if HDRM.install_error then
dt.print_error(_('HDRMerge install issue'))
dt.print_error('HDRMerge install issue')
dt.print(_('HDRMerge install issue, please ensure the binary path is proper'))
return
end
@@ -277,7 +279,7 @@ local function main()
end
dt.print(_('HDRMerge completed successfully'))
else
dt.print_error(_('HDRMerge failed'))
dt.print_error('HDRMerge failed')
dt.print(_('HDRMerge failed'))
end
@@ -378,7 +380,7 @@ local lbl_import = dt.new_widget('section_label'){
}
GUI.Target.style = dt.new_widget('combobox'){
label = _('apply style on import'),
tooltip = _('Apply selected style on auto-import to newly created image'),
tooltip = _('apply selected style on auto-import to newly created image'),
selected = 1,
_('none'),
changed_callback = function(self)
@@ -407,9 +409,9 @@ GUI.Target.copy_tags = dt.new_widget('check_button'){
temp = dt.preferences.read(mod, 'active_add_tags', 'string')
if temp == '' then temp = nil end
GUI.Target.add_tags = dt.new_widget('entry'){
tooltip = _('Additional tags to be added on import. Seperate with commas, all spaces will be removed'),
tooltip = _('additional tags to be added on import, seperate with commas, all spaces will be removed'),
text = temp,
placeholder = _('Enter tags, seperated by commas'),
placeholder = _('enter tags, seperated by commas'),
editable = true
}
GUI.run = dt.new_widget('button'){
@@ -418,7 +420,7 @@ GUI.run = dt.new_widget('button'){
clicked_callback = function() main() end
}
GUI.exes.HDRMerge = dt.new_widget('file_chooser_button'){
title = _('Select HDRmerge executable'),
title = _('select HDRmerge executable'),
value = df.get_executable_path_preference(HDRM.name),
is_directory = false
}

View File

@@ -52,6 +52,14 @@ local du = require "lib/dtutils"
du.check_min_api_version("7.0.0", "LabelsToTags")
local gettext = dt.gettext.gettext
gettext.bindtextdomain("LabelsToTags", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext(msgid)
end
-- return data structure for script_manager
local script_data = {}
@@ -68,7 +76,7 @@ local ltt = {}
ltt.module_installed = false
ltt.event_registered = false
local LIB_ID = "LabelsToTags"
local LIB_ID = _("LabelsToTags")
-- Helper functions: BEGIN
@@ -109,23 +117,23 @@ end
local initialAvailableMappings = {
["Colors"] = { ["+*****"] = { "Red" },
["*+****"] = { "Yellow" },
["**+***"] = { "Green" },
["***+**"] = { "Blue" },
["****+*"] = { "Purple" } },
["Single colors"] = { ["+----*"] = { "Red", "Only red" },
["-+---*"] = { "Yellow", "Only yellow" },
["--+--*"] = { "Green", "Only green" },
["---+-*"] = { "Blue", "Only blue" },
["----+*"] = { "Purple", "Only purple" } },
["Ratings"] = { ["*****0"] = { "No stars", "Not rejected" },
["*****1"] = { "One star", "Not rejected" },
["*****2"] = { "Two stars", "Not rejected" },
["*****3"] = { "Three stars", "Not rejected" },
["*****4"] = { "Four stars", "Not rejected" },
["*****5"] = { "Five stars", "Not rejected" },
["*****R"] = { "Rejected" } }
[_("colors")] = { ["+*****"] = { _("red") },
["*+****"] = { _("yellow") },
["**+***"] = { _("green") },
["***+**"] = { _("blue") },
["****+*"] = { _("purple") } },
[_("single colors")] = { ["+----*"] = { _("red"), _("only red") },
["-+---*"] = { _("Yellow"), _("only yellow") },
["--+--*"] = { _("Green"), _("only green") },
["---+-*"] = { _("Blue"), _("only blue") },
["----+*"] = { _("Purple"), _("only purple") } },
[_("ratings")] = { ["*****0"] = { _("no stars"), _("not rejected") },
["*****1"] = { _("one star"), _("not rejected") },
["*****2"] = { _("two stars"), _("not rejected") },
["*****3"] = { _("three stars"), _("not rejected") },
["*****4"] = { _("four stars"), _("not rejected") },
["*****5"] = { _("five stars"), _("not rejected") },
["*****R"] = { _("rejected") } }
}
local availableMappings = {}
@@ -140,14 +148,14 @@ end
local function getComboboxTooltip()
if availableMappings == nil or next(availableMappings) == nil then
return("No registered mappings -- using defaults")
return(_("no registered mappings -- using defaults"))
else
return("Select a label-to-tag mapping")
return(_("select a label-to-tag mapping"))
end
end
local mappingComboBox = darktable.new_widget("combobox"){
label = "mapping",
label = _("mapping"),
value = 1,
tooltip = getComboboxTooltip(),
reset_callback = function(selfC)
@@ -170,7 +178,7 @@ local mappingComboBox = darktable.new_widget("combobox"){
}
local function doTagging(selfC)
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)
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)
job.percent = 0.0
local pctIncrement = 1.0 / #(darktable.gui.action_images)

View File

@@ -51,7 +51,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local dsys = require "lib/dtutils.system"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
--Check API version
du.check_min_api_version("7.0.0", "OpenInExplorer")
@@ -65,11 +65,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("OpenInExplorer",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("OpenInExplorer", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("OpenInExplorer", msgid)
return gettext(msgid)
end
local act_os = dt.configuration.running_os
@@ -77,7 +76,7 @@ local PS = act_os == "windows" and "\\" or "/"
--Detect OS and quit if it is not supported.
if act_os ~= "macos" and act_os ~= "windows" and act_os ~= "linux" then
dt.print(_("OpenInExplorer plug-in only supports Linux, macOS, and Windows at this time"))
dt.print(_("OpenInExplorer plug-in only supports linux, macos, and windows at this time"))
dt.print_error("OpenInExplorer plug-in only supports Linux, macOS, and Windows at this time")
return
end
@@ -93,11 +92,11 @@ local function check_if_links_dir_exists()
local dir_exists = true
if not links_dir then
--Just for paranoic reasons. I tried, but I couldn't devise a setting for a nil value.
dt.print(_("No links directory selected.\nPlease check the dt preferences (lua options)"))
dt.print(_("no links directory selected\nplease check the dt preferences (lua options)"))
dt.print_error("OpenInExplorer: No links directory selected")
dir_exists = false
elseif not df.check_if_file_exists(links_dir) then
dt.print(string.format(_("Links directory '%s' not found.\nPlease check the dt preferences (lua options)"), links_dir))
dt.print(string.format(_("links directory '%s' not found\nplease check the dt preferences (lua options)"), links_dir))
dt.print_error(string.format("OpenInExplorer: Links directory '%s' not found", links_dir))
dir_exists = false
end
@@ -154,7 +153,7 @@ local function set_links(selected_images)
end
]]
if dsys.external_command(run_cmd) ~= 0 then
dt.print(_("Failed to create links. Missing rights?"))
dt.print(_("failed to create links, missing rights?"))
dt.print_error("OpenInExplorer: Failed to create links")
return
end
@@ -170,13 +169,13 @@ end
local function open_in_fmanager()
local images = dt.gui.selection()
if #images == 0 then
dt.print(_("Please select an image"))
dt.print(_("please select an image"))
else
if use_links and not check_if_links_dir_exists() then
return
end
if #images > 15 and not use_links then
dt.print(_("Please select fewer images (max. 15)"))
dt.print(_("please select fewer images (max. 15)"))
elseif use_links then
set_links(images)
else
@@ -203,7 +202,7 @@ end
dt.gui.libs.image.register_action(
"OpenInExplorer", _("show in file explorer"),
function() open_in_fmanager() end,
_("Open the file manager at the selected image's location")
_("open the file manager at the selected image's location")
)
@@ -211,17 +210,17 @@ if act_os ~= "windows" then
dt.preferences.register("OpenInExplorer", "linked_image_files_dir", -- name
"directory", -- type
_("OpenInExplorer: linked files directory"), -- label
_("Directory to store the links to the file names. Requires restart to take effect"), -- tooltip
_("directory to store the links to the file names, requires restart to take effect"), -- tooltip
"Links to image files", -- default
dt.new_widget("file_chooser_button"){
title = _("Select directory"),
title = _("select directory"),
is_directory = true,
}
)
dt.preferences.register("OpenInExplorer", "use_links", -- name
"bool", -- type
_("OpenInExplorer: use links"), -- label
_("Use links instead of multiple windows. Requires restart to take effect"), -- tooltip
_("use links instead of multiple windows, requires restart to take effect"), -- tooltip
false, -- default
""
)

View File

@@ -78,10 +78,12 @@ script_data.show = nil -- only required for libs since the destroy_method only h
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
-- translation
local gettext = dt.gettext
gettext.bindtextdomain(MODULE_NAME, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
local gettext = dt.gettext.gettext
gettext.bindtextdomain("RL_out_sharp", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE_NAME, msgid)
return gettext(msgid)
end
-- initialize module preferences
@@ -137,7 +139,7 @@ local function export2RL(storage, image_table, extra_data)
for image, temp_name in pairs(image_table) do
i = i + 1
dt.print(_("sharpening image ")..i.." ...")
dt.print(string.format(_("sharpening image %d ..."), i))
-- create unique filename
new_name = output_folder..PS..df.get_basename(temp_name)..".jpg"
new_name = df.create_unique_filename(new_name)

View File

@@ -42,6 +42,13 @@ local filelib = require "lib/dtutils.file"
du.check_min_api_version("7.0.0", "autostyle")
local gettext = darktable.gettext.gettext
gettext.bindtextdomain("autostyle", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext(msgid)
end
-- return data structure for script_manager
local script_data = {}
@@ -92,19 +99,19 @@ local function autostyle_apply_one_image (image)
-- check they all exist (correct syntax)
if (not tag) then
darktable.print("EXIF TAG not found in " .. pref)
darktable.print(string.format(_("EXIF tag not found in %s"), pref))
return 0
end
if (not value) then
darktable.print("value to match not found in " .. pref)
darktable.print(string.format(_("value to match not found in %s"), pref))
return 0
end
if (not style_name) then
darktable.print("style name not found in " .. pref)
darktable.print(string.format(_("style name not found in %s"), pref))
return 0
end
if not filelib.check_if_bin_exists("exiftool") then
darktable.print("Can't find exiftool")
darktable.print(_("can't find exiftool"))
return 0
end
@@ -118,7 +125,7 @@ local function autostyle_apply_one_image (image)
end
end
if (not style) then
darktable.print("style not found for autostyle: " .. style_name)
darktable.print(string.format(_("style not found for autostyle: %s"), style_name))
return 0
end
@@ -127,7 +134,7 @@ local function autostyle_apply_one_image (image)
--darktable.print_error("dr_attr:" .. auto_dr_attr)
-- If the lookup fails, stop here
if (not ok) then
darktable.print("Couldn't get attribute " .. auto_dr_attr .. " from exiftool's output")
darktable.print(string.format(_("couldn't get attribute %s from exiftool's output"), auto_dr_attr))
return 0
end
if auto_dr_attr == value then
@@ -154,7 +161,7 @@ local function autostyle_apply(shortcut)
images_submitted = images_submitted + 1
images_processed = images_processed + autostyle_apply_one_image(image)
end
darktable.print("Applied auto style to " .. images_processed .. " out of " .. images_submitted .. " image(s)")
darktable.print(string.format(_("applied auto style to %d out of %d image(s)"), images_processed, images_submitted))
end
local function destroy()
@@ -164,9 +171,9 @@ end
-- Registering events
darktable.register_event("autostyle", "shortcut", autostyle_apply,
"Apply your chosen style from exiftool tags")
_("apply your chosen style from exiftool tags"))
darktable.preferences.register("autostyle", "exif_tag", "string", "Autostyle: EXIF_tag=value=>style", "apply a style automatically if an EXIF_tag matches value. Find the tag with exiftool", "")
darktable.preferences.register("autostyle", "exif_tag", "string", "Autostyle: EXIF_tag=value=>style", _("apply a style automatically if an EXIF tag matches value, find the tag with exiftool"), "")
darktable.register_event("autostyle", "post-import-image",
autostyle_apply_one_image_event)

View File

@@ -36,10 +36,12 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
local MODULE = "change_group_leader"
gettext.bindtextdomain(MODULE, dt.configuration.config_dir .."/lua/locale/")
du.check_min_api_version("3.0.0", MODULE)
-- return data structure for script_manager
@@ -51,11 +53,8 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain(MODULE, dt.configuration.config_dir.."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE, msgid)
return gettext(msgid)
end
-- create a namespace to contain persistent data and widgets
@@ -121,7 +120,7 @@ end
local function process_image_groups(images)
if #images < 1 then
dt.print(_("No images selected."))
dt.print(_("o images selected"))
dt.print_log(MODULE .. "no images seletected, returning...")
else
local mode = cgl.widgets.mode.value
@@ -161,7 +160,7 @@ cgl.widgets.mode = dt.new_widget("combobox"){
}
cgl.widgets.execute = dt.new_widget("button"){
label = _("Execute"),
label = _("execute"),
clicked_callback = function()
process_image_groups(dt.gui.action_images)
end

View File

@@ -48,18 +48,17 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local gettext = dt.gettext
local gettext = dt.gettext.gettext
gettext.bindtextdomain("clear_GPS", dt.configuration.config_dir .."/lua/locale/")
-- not a number
local NaN = 0/0
du.check_min_api_version("7.0.0", "clear_GPS")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("clear_GPS",dt.configuration.config_dir.."/lua/locale/")
local function _(msgid)
return gettext.dgettext("clear_GPS", msgid)
return gettext(msgid)
end
local function clear_GPS(images)
@@ -81,13 +80,13 @@ script_data.destroy = destroy
dt.gui.libs.image.register_action(
"clear_GPS", _("clear GPS data"),
function(event, images) clear_GPS(images) end,
_("Clear GPS data from selected images")
_("clear GPS data from selected images")
)
dt.register_event(
"clear_GPS", "shortcut",
function(event, shortcut) clear_GPS(dt.gui.action_images) end,
_("Clear GPS data")
_("clear GPS data")
)
return script_data

View File

@@ -52,13 +52,12 @@ du.check_min_api_version("7.0.0", "color_profile_manager")
-- L O C A L I Z A T I O N
-- - - - - - - - - - - - - - - - - - - - - - - -
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("color_profile_manager", dt.configuration.config_dir .. "/lua/locale/")
gettext.bindtextdomain("color_profile_manager", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("color_profile_manager", msgid)
return gettext(msgid)
end
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -119,13 +118,13 @@ end
local function add_profile(file, dir)
df.file_copy(file, dir)
dt.print(_("added color profile " .. file .. " to " .. dir))
dt.print(string.format(_("added color profile %s to %s"), file, dir))
dt.print_log("color profile " .. file .. " added to " .. dir)
end
local function remove_profile(file, dir)
os.remove(dir .. PS .. file)
dt.print(_("removed color profile " .. file .. " from " .. dir))
dt.print(string.format(_("removed color profile %s from %s"), file, dir))
dt.print_log("color profile " .. file .. " removed from " .. dir)
end

View File

@@ -40,7 +40,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local debug = require "darktable.debug"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "copy_attach_detach_tags")
@@ -53,11 +53,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("copy_attach_detach_tags",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("copy_attach_detach_tags", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("copy_attach_detach_tags", msgid)
return gettext(msgid)
end
local cadt = {}
@@ -99,7 +98,7 @@ local function mcopy_tags()
end
end
dt.print(_('Image tags copied ...'))
dt.print(_('image tags copied ...'))
--create UI tag list
local taglist = ""
@@ -121,7 +120,7 @@ local function mcopy_tags()
local function attach_tags()
if next(image_tags) == nil then
dt.print(_('No tag to attach, please copy tags first.'))
dt.print(_('no tag to attach, please copy tags first.'))
return true
end
@@ -145,7 +144,7 @@ local function attach_tags()
end
end
end
dt.print(_('Tags attached ...'))
dt.print(_('tags attached ...'))
end
local function detach_tags()
@@ -161,13 +160,13 @@ local function detach_tags()
end
end
end
dt.print(_('Tags removed from image(s).'))
dt.print(_('tags removed from image(s).'))
end
local function replace_tags()
detach_tags()
attach_tags()
dt.print(_('Tags replaced'))
dt.print(_('tags replaced'))
end
local function install_module()

View File

@@ -37,6 +37,14 @@ local du = require "lib/dtutils"
du.check_min_api_version("7.0.0", "cr2hdr")
local gettext = dt.gettext.gettext
gettext.bindtextdomain("cr2hdr", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext(msgid)
end
-- return data structure for script_manager
local script_data = {}
@@ -87,7 +95,7 @@ end
local function convert_images()
if next(queue) == nil then return end
job = darktable.gui.create_job("Dual ISO conversion", true, stop_conversion)
job = darktable.gui.create_job(_("dual ISO conversion"), true, stop_conversion)
for key,image in pairs(queue) do
if job.valid then
job.percent = (key-1)/#queue
@@ -98,7 +106,7 @@ local function convert_images()
end
local success_count = 0
for _ in pairs(processed_files) do success_count = success_count + 1 end
darktable.print("Dual ISO conversion successful on " .. success_count .. "/" .. #queue .. " images.")
darktable.print(string.format(_("dual ISO conversion successful on %d/%d images."), success_count, #queue))
job.valid = false
processed_files = {}
queue = {}
@@ -122,13 +130,13 @@ local function destroy()
end
darktable.register_event("cr2hdr", "shortcut",
convert_action_images, "Run cr2hdr (Magic Lantern DualISO converter) on selected images")
convert_action_images, _("run cr2hdr (Magic Lantern DualISO converter) on selected images"))
darktable.register_event("cr2hdr", "post-import-image",
file_imported)
darktable.register_event("cr2hdr", "post-import-film",
film_imported)
darktable.preferences.register("cr2hdr", "onimport", "bool", "Invoke on import", "If true then cr2hdr will try to proccess every file during importing. Warning: cr2hdr is quite slow even in figuring out on whether the file is Dual ISO or not.", false)
darktable.preferences.register("cr2hdr", "onimport", "bool", _("invoke on import"), _("if true then cr2hdr will try to proccess every file during importing\nwarning: cr2hdr is quite slow even in figuring out on whether the file is dual ISO or not."), false)
script_data.destroy = destroy

View File

@@ -69,13 +69,12 @@ script_data.show = nil -- only required for libs since the destroy_method only h
-- I 1 8 N
-- - - - - - - - - - - - - - - - - - - - - - - - - -
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain(MODULE, dt.configuration.config_dir .. "/lua/locale/")
gettext.bindtextdomain("cycle_group_leader", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE, msgid)
return gettext(msgid)
end
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -100,7 +99,7 @@ end
local function cycle_group_leader(image)
local group_images = image:get_group_members()
if #group_images < 2 then
hinter_msg(_("No images to cycle to in group"))
hinter_msg(_("no images to cycle to in group"))
return
else
local position = nil
@@ -147,7 +146,7 @@ dt.register_event(MODULE, "shortcut",
-- ignore the film roll, it contains all the images, not just the imported
local images = dt.gui.selection()
if #images < 1 then
dt.print(_("No image selected. Please select an image and try again"))
dt.print(_("no image selected, please select an image and try again"))
else
cycle_group_leader(images[1])
end

View File

@@ -77,10 +77,12 @@ script_data.restart = nil -- how to restart the (lib) script after it's been hid
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
local gettext = dt.gettext
gettext.bindtextdomain('enfuseAdvanced',dt.configuration.config_dir..'/lua/locale/')
local gettext = dt.gettext.gettext
gettext.bindtextdomain("enfuseAdvanced", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext('enfuseAdvanced', msgid)
return gettext(msgid)
end
-- INITS --
@@ -260,7 +262,7 @@ local function ExeUpdate(prog_tbl) --updates executable paths and verifies them
if not prog.bin then
prog.install_error = true
dt.preferences.write(mod, 'bin_exists', 'bool', false)
dt.print(_('issue with ')..prog.name.._(' executable'))
dt.print(string.format(_("issue with %s executable"), prog.name))
else
prog.bin = CleanSpaces(prog.bin)
end
@@ -377,7 +379,7 @@ local function SaveToPreference(preset) --save the present values of enfuse GUI
dt.preferences.write(mod, preset..argument, arg_data.style, temp)
end
end
dt.print(_('saved to ')..preset)
dt.print(string.format(_("saved to %s"), preset))
end
local function LoadFromPreference(preset) --load values from the specified 'preset' into the GUI elements
@@ -393,7 +395,7 @@ local function LoadFromPreference(preset) --load values from the specified 'pres
dt.preferences.write(mod, 'active_'..argument, arg_data.style, temp)
end
end
dt.print(_('loaded from ')..preset)
dt.print(string.format(_("loaded from %s"), preset))
end
local function remove_temp_files(images_to_remove) --deletes all files specified by the input string
@@ -428,7 +430,7 @@ local function support_format(storage, format) --tells dt we only support TIFF e
end
local function show_status(storage, image, format, filename, number, total, high_quality, extra_data) --outputs message to user showing script export status
dt.print(_('export for image fusion ')..tostring(math.floor(number))..' / '..tostring(math.floor(total)))
dt.print(string.format(_("export for image fusion %d / %d"), math.floor(number), math.floor(total)))
end
local function main(storage, image_table, extra_data)
@@ -456,8 +458,8 @@ local function main(storage, image_table, extra_data)
job.valid = false
if resp ~= 0 then
remove_temp_files(images_to_remove)
dt.print_error(AIS.name.._(' failed'))
dt.print(AIS.name.._(' failed'))
dt.print(string.format(_("%s failed"), AIS.name))
dt.print_error(AIS.name .. ' failed')
return
end
end
@@ -483,8 +485,8 @@ local function main(storage, image_table, extra_data)
local resp = dsys.external_command(run_cmd)
if resp ~= 0 then
remove_temp_files(images_to_remove)
dt.print_error(ENF.name.._(' failed'))
dt.print(ENF.name.._(' failed'))
dt.print_error(ENF.name..' failed')
dt.print(string.format(_("%s failed"), ENF.name))
return
end
@@ -729,7 +731,7 @@ GUI.ENF.hard_masks = dt.new_widget('check_button'){
GUI.ENF.save_masks = dt.new_widget('check_button'){
label = _('save masks'),
value = dt.preferences.read(mod, 'active_save_masks', 'bool'),
tooltip = _('Save the generated weight masks to your home directory,\nenblend saves masks as 8 bit grayscale, \ni.e. single channel images. \nfor accuracy we recommend to choose a lossless format.'),
tooltip = _('save the generated weight masks to your home directory,\nenblend saves masks as 8 bit grayscale, \ni.e. single channel images. \nfor accuracy we recommend to choose a lossless format.'),
clicked_callback = function(self) dt.preferences.write(mod, 'active_save_masks', 'bool', self.value) end,
reset_callback = function(self) self.value = false end
}
@@ -882,7 +884,7 @@ GUI.Target.output_directory = dt.new_widget('file_chooser_button'){
GUI.Target.source_location = dt.new_widget('check_button'){
label = _('save to source image location'),
value = dt.preferences.read(mod, 'active_source_location', 'bool'),
tooltip = _('If checked ignores the location above and saves output image(s) to the same location as the source images.'),
tooltip = _('if checked ignores the location above and saves output image(s) to the same location as the source images.'),
clicked_callback = function(self) dt.preferences.write(mod, 'active_source_location', 'bool', self.value) end,
reset_callback = function(self) self.value = true end
}
@@ -916,8 +918,8 @@ GUI.Target.auto_import = dt.new_widget('check_button'){
}
temp = dt.preferences.read(mod, 'active_apply_style_ind', 'integer')
GUI.Target.apply_style = dt.new_widget('combobox'){
label = _('Apply Style on Import'),
tooltip = _('Apply selected style on auto-import to newly created blended image'),
label = _('apply style on Import'),
tooltip = _('apply selected style on auto-import to newly created blended image'),
selected = 1,
'none',
changed_callback = function(self)
@@ -938,16 +940,16 @@ GUI.Target.apply_style.selected = temp
GUI.Target.copy_tags = dt.new_widget('check_button'){
label = _('copy tags'),
value = dt.preferences.read(mod, 'active_copy_tags', 'bool'),
tooltip = _('Copy tags from first image.'),
tooltip = _('copy tags from first image.'),
clicked_callback = function(self) dt.preferences.write(mod, 'active_copy_tags', 'bool', self.value) end,
reset_callback = function(self) self.value = true end
}
temp = dt.preferences.read(mod, 'active_add_tags', 'string')
if temp == '' then temp = nil end
GUI.Target.add_tags = dt.new_widget('entry'){
tooltip = _('Additional tags to be added on import. Seperate with commas, all spaces will be removed'),
tooltip = _('additional tags to be added on import, seperate with commas, all spaces will be removed'),
text = temp,
placeholder = 'Enter tags, seperated by commas',
placeholder = _('enter tags, seperated by commas'),
editable = true
}
temp = dt.preferences.read(mod, 'active_current_preset_ind', 'integer')

View File

@@ -42,12 +42,12 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local gettext = dt.gettext
local gettext = dt.gettext.gettext
gettext.bindtextdomain("exportLUT",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("exportLUT", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("exportLUT", msgid)
return gettext(msgid)
end
du.check_min_api_version("5.0.0", "exportLUT")
@@ -64,13 +64,13 @@ local mkdir_command = 'mkdir -p '
if dt.configuration.running_os == 'windows' then mkdir_command = 'mkdir ' end
local file_chooser_button = dt.new_widget("file_chooser_button"){
title = _("Identity_file_chooser"),
title = _("identity_file_chooser"),
value = "",
is_directory = false
}
local export_chooser_button = dt.new_widget("file_chooser_button"){
title = _("Export_location_chooser"),
title = _("export_location_chooser"),
value = "",
is_directory = true
}
@@ -106,9 +106,9 @@ end
local function export_luts()
local identity = dt.database.import(file_chooser_button.value)
if(type(identity) ~= "userdata") then
dt.print(_("Invalid identity lut file"))
dt.print(_("invalid identity lut file"))
else
local job = dt.gui.create_job(_('Exporting styles as haldCLUTs'), true, end_job)
local job = dt.gui.create_job(_('exporting styles as haldCLUTs'), true, end_job)
local size = 1
@@ -127,9 +127,9 @@ local function export_luts()
io_lut:write_image(identity, output_path(style.name, job))
count = count + 1
job.percent = count / size
dt.print(_("Exported: ") .. output_path(style.name, job))
dt.print(string.format(_("exported: %s"), output_path(style.name, job)))
end
dt.print(_("Done exporting haldCLUTs"))
dt.print(_("done exporting haldCLUTs"))
job.valid = false
identity:reset()
end

View File

@@ -95,10 +95,12 @@ ee.widgets = {}
-- translation
local gettext = dt.gettext
gettext.bindtextdomain(MODULE_NAME, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
local gettext = dt.gettext.gettext
gettext.bindtextdomain("ext_editor", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE_NAME, msgid)
return gettext(msgid)
end
-- maximum number of external programs, can be increased to necessity
@@ -156,7 +158,7 @@ local function UpdateProgramList(combobox, button_edit, button_edit_copy, update
button_edit.sensitive = active
button_edit_copy.sensitive = active
if update_button_pressed then dt.print(n_entries.._(" editors configured")) end
if update_button_pressed then dt.print(string.format(_("%d editors configured"), n_entries)) end
end
@@ -223,17 +225,17 @@ local function OpenWith(images, choice, copy)
-- physical copy, check result, return if error
local copy_success = df.file_copy(name, new_name)
if not copy_success then
dt.print(_("error copying file ")..name)
dt.print(string.format(_("error copying file %s"), name))
return
end
end
-- launch the external editor, check result, return if error
local run_cmd = bin.." "..df.sanitize_filename(new_name)
dt.print(_("launching ")..friendly_name.."...")
dt.print(string.format(_("launching %s..."), friendly_name))
local result = dtsys.external_command(run_cmd)
if result ~= 0 then
dt.print(_("error launching ")..friendly_name)
dt.print(string.format(_("error launching %s"), friendly_name))
return
end
@@ -326,7 +328,7 @@ local function export2collection(storage, image_table, extra_data)
-- move image to collection folder, check result, return if error
move_success = df.file_move(temp_name, new_name)
if not move_success then
dt.print(_("error moving file ")..temp_name)
dt.print(string.format(_("error moving file %s"), temp_name))
return
end
@@ -378,7 +380,7 @@ end
local function restart()
for i = 1, MAX_EDITORS do
dt.register_event(MODULE_NAME .. i, "shortcut",
program_shortcut, _("edit with program ")..string.format("%02d", i))
program_shortcut, string.format(_("edit with program %02d"), i))
end
dt.register_storage("exp2coll", _("collection"), nil, export2collection)
dt.gui.libs[MODULE_NAME].visible = true
@@ -476,11 +478,11 @@ dt.register_storage("exp2coll", _("collection"), nil, export2collection)
-- register the new preferences -----------------------------------------------
for i = MAX_EDITORS, 1, -1 do
dt.preferences.register(MODULE_NAME, "program_path_"..i, "file",
_("executable for external editor ")..i,
_("select executable for external editor") , _("(None)"))
string.format(_("executable for external editor %d"), i),
_("select executable for external editor") , _("(none)"))
dt.preferences.register(MODULE_NAME, "program_name_"..i, "string",
_("name of external editor ")..i,
string.format(_("name of external editor %d"), i),
_("friendly name of external editor"), "")
end
dt.preferences.register(MODULE_NAME, "show_in_darkrooom", "bool",
@@ -491,7 +493,7 @@ dt.preferences.register(MODULE_NAME, "show_in_darkrooom", "bool",
-- register the new shortcuts -------------------------------------------------
for i = 1, MAX_EDITORS do
dt.register_event(MODULE_NAME .. i, "shortcut",
program_shortcut, _("edit with program ")..string.format("%02d", i))
program_shortcut, string.format(_("edit with program %02d"), i))
end

View File

@@ -44,7 +44,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local dtsys = require "lib/dtutils.system"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- constants
@@ -69,11 +69,10 @@ local fc = {}
fc.module_installed = false
fc.event_registered = false
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("face_recognition", dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("face_recognition", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("face_recognition", msgid)
return gettext(msgid)
end
local function build_image_table(images)
@@ -135,7 +134,7 @@ local function do_export(img_tbl, images)
job.percent = 0.0
for export,img in pairs(img_tbl) do
exp_cnt = exp_cnt + 1
dt.print(string.format(_("Exporting image %i of %i images"), exp_cnt, images))
dt.print(string.format(_("exporting image %i of %i images"), exp_cnt, images))
exporter:write_image(img, export, upsize)
job.percent = job.percent + percent_step
end
@@ -205,7 +204,7 @@ local function face_recognition ()
local bin_path = df.check_if_bin_exists("face_recognition")
if not bin_path then
dt.print(_("Face recognition not found"))
dt.print(_("face recognition not found"))
return
end
@@ -257,7 +256,7 @@ local function face_recognition ()
local command = bin_path .. " --cpus " .. nrCores .. " --tolerance " .. tolerance .. " " .. knownPath .. " " .. path .. " > " .. OUTPUT
os.setlocale()
dt.print_log("Face recognition: Running command: " .. command)
dt.print(_("Starting face recognition..."))
dt.print(_("starting face recognition..."))
dtsys.external_command(command)
@@ -265,9 +264,9 @@ local function face_recognition ()
local f = io.open(OUTPUT, "rb")
if not f then
dt.print(_("Face recognition failed"))
dt.print(_("face recognition failed"))
else
dt.print(_("Face recognition finished"))
dt.print(_("face recognition finished"))
f:close ()
end
@@ -399,7 +398,7 @@ fc.category_tags = dt.new_widget("entry"){
fc.tolerance = dt.new_widget("slider"){
label = _("tolerance"),
tooltip = ("detection tolerance - 0.6 default - lower if too many faces detected"),
tooltip = _("detection tolerance - 0.6 default - lower if too many faces detected"),
soft_min = 0.0,
hard_min = 0.0,
soft_max = 1.0,
@@ -482,12 +481,12 @@ table.insert(widgets, fc.num_cores)
table.insert(widgets, fc.export_format)
table.insert(widgets, dt.new_widget("box"){
orientation = "horizontal",
dt.new_widget("label"){ label = _("width ")},
dt.new_widget("label"){ label = _("width")},
fc.width,
})
table.insert(widgets, dt.new_widget("box"){
orientation = "horizontal",
dt.new_widget("label"){ label = _("height ")},
dt.new_widget("label"){ label = _("height")},
fc.height,
})
table.insert(widgets, fc.execute)

View File

@@ -26,7 +26,7 @@ Dependencies:
local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "fujifilm_ratings")
@@ -39,10 +39,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
gettext.bindtextdomain("fujifilm_ratings", dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("fujifilm_ratings", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("fujifilm_ratings", msgid)
return gettext(msgid)
end
local function detect_rating(event, image)
@@ -60,7 +60,7 @@ local function detect_rating(event, image)
if string.len(jpeg_result) > 0 then
jpeg_result = string.gsub(jpeg_result, "^Rating.*(%d)", "%1")
image.rating = tonumber(jpeg_result)
dt.print_error(_("Using JPEG Rating: ") .. tostring(jpeg_result))
dt.print_error(string.format(_("using JPEG rating: %d"), jpeg_result))
return
end
command = "exiftool -Rating " .. RAF_filename
@@ -71,7 +71,7 @@ local function detect_rating(event, image)
if string.len(raf_result) > 0 then
raf_result = string.gsub(raf_result, "^Rating.*(%d)", "%1")
image.rating = tonumber(raf_result)
dt.print_error(_("Using RAF Rating: ") .. tostring(raf_result))
dt.print_error(string.format(_("using RAF rating: %d"), raf_result))
end
end

View File

@@ -35,7 +35,7 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "geoJSON_export")
@@ -48,11 +48,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("geoJSON_export",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("geoJSON_export", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("geoJSON_export", msgid)
return gettext(msgid)
end
-- Sort a table
@@ -80,7 +79,7 @@ local function spairs(_table, order) -- Code copied from http://stackoverflow.co
end
local function show_status(storage, image, format, filename, number, total, high_quality, extra_data)
dt.print(string.format(_("Export Image %i/%i"), number, total))
dt.print(string.format(_("export image %i/%i"), number, total))
end
local function create_geoJSON_file(storage, image_table, extra_data)
@@ -309,19 +308,19 @@ dt.preferences.register("geoJSON_export",
"CreateMapBoxHTMLFile",
"bool",
_("geoJSON export: Create an additional HTML file"),
_("Creates a HTML file, that loads the geoJASON file. (Needs a MapBox key"),
_("creates an HTML file that loads the geoJSON file. (needs a MapBox key"),
false )
dt.preferences.register("geoJSON_export",
"mapBoxKey",
"string",
_("geoJSON export: MapBox Key"),
_("geoJSON export: MapBox key"),
_("https://www.mapbox.com/studio/account/tokens"),
'' )
dt.preferences.register("geoJSON_export",
"OpengeoJSONFile",
"bool",
_("geoJSON export: Open geoJSON file after export"),
_("Opens the geoJSON file after the export with the standard program for geoJSON files"),
_("geoJSON export: open geoJSON file after export"),
_("opens the geoJSON file after the export with the standard program for geoJSON files"),
false )
local handle = io.popen("xdg-user-dir DESKTOP")
@@ -333,8 +332,8 @@ end
dt.preferences.register("geoJSON_export",
"ExportDirectory",
"directory",
_("geoJSON export: Export directory"),
_("A directory that will be used to export the geoJSON files"),
_("geoJSON export: export directory"),
_("a directory that will be used to export the geoJSON files"),
result )
-- Register

View File

@@ -28,7 +28,7 @@ require "geoToolbox"
local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "geoToolbox")
@@ -41,11 +41,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("geoToolbox",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("geoToolbox", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("geoToolbox", msgid)
return gettext(msgid)
end
@@ -56,7 +55,7 @@ gT.event_registered = false
-- <GUI>
local labelDistance = dt.new_widget("label")
labelDistance.label = _("Distance:")
labelDistance.label = _("distance:")
local label_copy_gps_lat = dt.new_widget("check_button")
{
@@ -300,9 +299,9 @@ local function copy_gps()
end
end
label_copy_gps_lat.label = _("latitude: ") .. copy_gps_latitude
label_copy_gps_lon.label = _("longitude: ") ..copy_gps_longitude
label_copy_gps_ele.label = _("elevation: ") .. copy_gps_elevation
label_copy_gps_lat.label = string.format(_("latitude: "), copy_gps_latitude)
label_copy_gps_lon.label = string.format(_("longitude: "),copy_gps_longitude)
label_copy_gps_ele.label = string.format(_("elevation: "), copy_gps_elevation)
return
end
@@ -493,7 +492,7 @@ local function calc_distance()
distanceUnit = _("km")
end
return string.format(_("Distance: %.2f %s"), distance, distanceUnit)
return string.format(_("distance: %.2f %s"), distance, distanceUnit)
end
local function print_calc_distance()
@@ -516,12 +515,12 @@ local altitude_filename = dt.new_widget("entry")
text = "altitude.csv",
placeholder = "altitude.csv",
editable = true,
tooltip = _("Name of the exported file"),
tooltip = _("name of the exported file"),
reset_callback = function(self) self.text = "text" end
}
local function altitude_profile()
dt.print(_("Start export"))
dt.print(_("start export"))
local sel_images = dt.gui.action_images
local lat1 = 0;
@@ -582,7 +581,7 @@ local function altitude_profile()
file = io.open(exportDirectory.."/"..exportFilename, "w")
file:write(csv_file)
file:close()
dt.print(_("File created in ")..exportDirectory)
dt.print(string.format(_("file created in %s"), exportDirectory))
end
@@ -612,14 +611,14 @@ end
local function restart()
dt.register_event("geoToolbox_cd", "shortcut",
print_calc_distance, _("Calculate the distance from latitude and longitude in km"))
print_calc_distance, _("calculate the distance from latitude and longitude in km"))
dt.register_event("geoToolbox", "mouse-over-image-changed",
toolbox_calc_distance)
dt.register_event("geoToolbox_wg", "shortcut",
select_with_gps, _("Select all images with GPS information"))
select_with_gps, _("select all images with GPS information"))
dt.register_event("geoToolbox_ng", "shortcut",
select_without_gps, _("Select all images without GPS information"))
select_without_gps, _("select all images without GPS information"))
dt.gui.libs["geoToolbox"].visible = true
end
@@ -642,20 +641,20 @@ gT.widget = dt.new_widget("box")
dt.new_widget("button")
{
label = _("select geo images"),
tooltip = _("Select all images with GPS information"),
tooltip = _("select all images with GPS information"),
clicked_callback = select_with_gps
},
dt.new_widget("button")
{
label = _("select non-geo images"),
tooltip = _("Select all images without GPS information"),
tooltip = _("select all images without GPS information"),
clicked_callback = select_without_gps
},
separator,--------------------------------------------------------
dt.new_widget("button")
{
label = _("copy GPS data"),
tooltip = _("Copy GPS data"),
tooltip = _("copy GPS data"),
clicked_callback = copy_gps
},
label_copy_gps_lat,
@@ -664,7 +663,7 @@ gT.widget = dt.new_widget("box")
dt.new_widget("button")
{
label = _("paste GPS data"),
tooltip = _("Paste GPS data"),
tooltip = _("paste GPS data"),
clicked_callback = paste_gps
},
separator2,--------------------------------------------------------
@@ -694,14 +693,14 @@ gT.widget = dt.new_widget("box")
dt.new_widget("button")
{
label = _("open in Gnome Maps"),
tooltip = _("Open location in Gnome Maps"),
tooltip = _("open location in Gnome Maps"),
clicked_callback = open_location_in_gnome_maps
},
separator4,--------------------------------------------------------
dt.new_widget("button")
{
label = _("reverse geocode"),
tooltip = _("This just shows the name of the location, but doesn't add it as tag"),
tooltip = _("this just shows the name of the location, but doesn't add it as tag"),
clicked_callback = reverse_geocode
},
separator5,--------------------------------------------------------
@@ -711,7 +710,7 @@ gT.widget = dt.new_widget("box")
dt.new_widget("button")
{
label = _("export altitude CSV file"),
tooltip = _("Create an altitude profile using the GPS data in the metadata"),
tooltip = _("create an altitude profile using the GPS data in the metadata"),
clicked_callback = altitude_profile
},
labelDistance
@@ -744,14 +743,14 @@ dt.preferences.register("geoToolbox",
-- Register
dt.register_event("geoToolbox_cd", "shortcut",
print_calc_distance, _("Calculate the distance from latitude and longitude in km"))
print_calc_distance, _("calculate the distance from latitude and longitude in km"))
dt.register_event("geoToolbox", "mouse-over-image-changed",
toolbox_calc_distance)
dt.register_event("geoToolbox_wg", "shortcut",
select_with_gps, _("Select all images with GPS information"))
select_with_gps, _("select all images with GPS information"))
dt.register_event("geoToolbox_ng", "shortcut",
select_without_gps, _("Select all images without GPS information"))
select_without_gps, _("select all images without GPS information"))
script_data.destroy = destroy
script_data.restart = restart

View File

@@ -69,7 +69,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local dtsys = require "lib/dtutils.system"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
local gimp_widget = nil
du.check_min_api_version("7.0.0", "gimp")
@@ -83,11 +83,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("gimp",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("gimp", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("gimp", msgid)
return gettext(msgid)
end
local function group_if_not_member(img, new_img)
@@ -109,7 +108,7 @@ end
local function show_status(storage, image, format, filename,
number, total, high_quality, extra_data)
dt.print(string.format(_("Export Image %i/%i"), number, total))
dt.print(string.format(_("export image %i/%i"), number, total))
end
local function gimp_edit(storage, image_table, extra_data) --finalize
@@ -119,7 +118,7 @@ local function gimp_edit(storage, image_table, extra_data) --finalize
local gimp_executable = df.check_if_bin_exists("gimp")
if not gimp_executable then
dt.print_error(_("GIMP not found"))
dt.print_error("GIMP not found")
return
end
@@ -142,7 +141,7 @@ local function gimp_edit(storage, image_table, extra_data) --finalize
img_list = img_list ..exp_img.. " "
end
dt.print(_("Launching GIMP..."))
dt.print(_("launching GIMP..."))
local gimpStartCommand
gimpStartCommand = gimp_executable .. " " .. img_list
@@ -213,7 +212,7 @@ gimp_widget = dt.new_widget("check_button"){
end
}
dt.register_storage("module_gimp", _("Edit with GIMP"), show_status, gimp_edit, nil, nil, gimp_widget)
dt.register_storage("module_gimp", _("edit with GIMP"), show_status, gimp_edit, nil, nil, gimp_widget)
--
script_data.destroy = destroy

View File

@@ -25,7 +25,7 @@ For each source folder, a separate <trk> is generated in the gpx file.
local dt = require "darktable"
local df = require "lib/dtutils.file"
local dl = require "lib/dtutils"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
dl.check_min_api_version("7.0.0", "gpx_export")
@@ -38,8 +38,7 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("gpx_export",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("gpx_export", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("gpx_export", msgid)
@@ -132,11 +131,11 @@ local function create_gpx_file()
local file = io.open(path, "w")
if (file == nil) then
dt.print(_("invalid path: ")..path)
dt.print(string.format(_("invalid path: %s"), path))
else
file:write(gpx_file)
file:close()
dt.print(_("gpx file created: ")..path)
dt.print(string.format(_("gpx file created: "), path))
end
end

View File

@@ -32,15 +32,14 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("2.0.0", "harmonic_armature_guide")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("harmonic_armature_guide",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("harmonic_armature_guide", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("harmonic_armature_guide", msgid)
return gettext(msgid)
end
dt.guides.register_guide("harmonic armature",

View File

@@ -73,13 +73,12 @@ script_data.show = nil -- only required for libs since the destroy_method only h
-- I 1 8 N
-- - - - - - - - - - - - - - - - - - - - - - - - - -
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain(MODULE, dt.configuration.config_dir .. "/lua/locale/")
gettext.bindtextdomain("hif_group_leader", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE, msgid)
return gettext(msgid)
end
@@ -182,7 +181,7 @@ dt.register_event(MODULE .. "_collect", "shortcut",
local images = dt.collection
make_existing_hif_group_leader(images)
end,
_("Make hif group leader for collection")
_("make hif group leader for collection")
)
dt.register_event(MODULE .. "_select", "shortcut",
@@ -190,7 +189,7 @@ dt.register_event(MODULE .. "_select", "shortcut",
local images = dt.gui.selection()
make_existing_hif_group_leader(images)
end,
_("Make hif group leader for selection")
_("make hif group leader for selection")
)
return script_data

View File

@@ -40,7 +40,7 @@ local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local log = require "lib/dtutils.log"
local dtsys = require "lib/dtutils.system"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
local namespace = 'module_hugin'
local user_pref_str = 'prefer_gui'
@@ -65,11 +65,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("hugin",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("hugin", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("hugin", msgid)
return gettext(msgid)
end
local function user_preference_changed(widget)
@@ -201,7 +200,7 @@ local function create_panorama(storage, image_table, extra_data) --finalize
if df.check_if_file_exists(src_path) then
log.msg(log.debug, "found ", src_path, " importing to ", dst_path)
df.file_move(src_path, dst_path)
dt.print(_("importing file "..dst_path))
dt.print(string.format(_("importing file %s"), dst_path))
dt.database.import(dst_path)
end
end
@@ -227,7 +226,7 @@ hugin_widget = dt.new_widget("box") {
orientation = "vertical",
dt.new_widget("check_button")
{
label = _(" launch hugin gui"),
label = _("launch hugin gui"),
value = user_prefer_gui,
tooltip = _('launch hugin in gui mode'),
clicked_callback = user_preference_changed

View File

@@ -64,7 +64,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local dtsys = require "lib/dtutils.system"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
local job = nil
-- path separator constant
@@ -82,11 +82,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("image_stack",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("image_stack", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("image_stack", msgid)
return gettext(msgid)
end
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -259,7 +258,7 @@ end
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
local function show_status(storage, image, format, filename, number, total, high_quality, extra_data)
dt.print(string.format(_("Export Image %i/%i"), number, total))
dt.print(string.format(_("export image %i/%i"), number, total))
end
-- read the gui and populate the align_image_stack arguments
@@ -452,7 +451,7 @@ local function copy_image_attributes(from, to, ...)
to.rights = from.rights
to.description = from.description
else
dt.print_error(_("Unrecognized option to copy_image_attributes: " .. arg))
dt.print_error("Unrecognized option to copy_image_attributes: " .. arg)
end
end
end
@@ -496,7 +495,7 @@ local function image_stack(storage, image_table, extra_data)
if image_count < 2 then
dt.print(_("ERROR: at least 2 images required for image stacking, exiting..."))
dt.print_error(_(image_count .. " image(s) selected, at least 2 required"))
dt.print_error(image_count .. " image(s) selected, at least 2 required")
return
end
@@ -520,13 +519,13 @@ local function image_stack(storage, image_table, extra_data)
job.percent = job.percent + percent_step
else
dt.print(_("ERROR: image alignment failed"))
dt.print_error(_("image alignment failed"))
dt.print_error("image alignment failed")
cleanup(img_list)
return
end
else
dt.print(_("ERROR: align_image_stack not found"))
dt.print_error(_("align_image_stack not found"))
dt.print_error("align_image_stack not found")
cleanup(img_list)
return
end
@@ -540,7 +539,7 @@ local function image_stack(storage, image_table, extra_data)
local ignore_tif_tags = " -quiet -define tiff:ignore-tags=40965,42032,42033,42034,42036,18246,18249,36867,34864,34866 "
if convert_executable then
local convert_command = convert_executable .. ignore_tif_tags .. convert_arguments
dt.print_log(_("convert command is " .. convert_command))
dt.print_log("convert command is " .. convert_command)
dt.print(_("processing image stack"))
local result = dtsys.external_command(convert_command)
if result == 0 then
@@ -554,7 +553,7 @@ local function image_stack(storage, image_table, extra_data)
local import_filename = df.create_unique_filename(film_roll_path .. PS .. df.get_filename(output_filename))
df.file_move(output_filename, import_filename)
imported_image = dt.database.import(import_filename)
local created_tag = dt.tags.create(_("Created with|image_stack"))
local created_tag = dt.tags.create(_("created with|image_stack"))
dt.tags.attach(created_tag, imported_image)
-- all the images are the same except for time, so just copy the attributes
-- from the first
@@ -568,7 +567,7 @@ local function image_stack(storage, image_table, extra_data)
if tag_source then
dt.print(_("tagging source images"))
local source_tag = dt.tags.create(_("Source file|" .. imported_image.filename))
local source_tag = dt.tags.create(_("source file|" .. imported_image.filename))
for img, _ in pairs(image_table) do
dt.tags.attach(source_tag, img)
end
@@ -580,7 +579,7 @@ local function image_stack(storage, image_table, extra_data)
end
else
dt.print(_("ERROR: convert executable not found"))
dt.print_error(_("convert executable not found"))
dt.print_error("convert executable not found")
cleanup(img_list)
end
job.valid = false
@@ -592,7 +591,7 @@ end
dt.preferences.register("align_image_stack", "align_use_gpu", -- name
"bool", -- type
_('align image stack: use GPU for remaping'), -- label
_('align image stack: use GPU for remapping'), -- label
_('set the GPU remapping for image align'), -- tooltip
false)

View File

@@ -107,7 +107,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local ds = require "lib/dtutils.string"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
local img_time = {}
img_time.module_installed = false
@@ -125,11 +125,11 @@ script_data.restart = nil -- how to restart the (lib) script after it's been hid
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("image_time",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("image_time", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("image_time", msgid)
return gettext(msgid)
end
local PS = dt.configuration.runnin_os == "windows" and "\\" or "/"
@@ -175,7 +175,7 @@ local function calculate_difference(images)
img_time.diff_entry.text = calc_time_difference(images[1], images[2])
img_time.btn.sensitive = true
else
dt.print(_("Error: 2 images must be selected"))
dt.print(_("ERROR: 2 images must be selected"))
end
end
@@ -249,7 +249,7 @@ local function _get_windows_image_file_creation_time(image)
end
p:close()
else
dt.print(_("unable to get information for ") .. image.filename)
dt.print(string.format(_("unable to get information for $s"), image.filename))
datetime = ERROR
end
return datetime
@@ -266,7 +266,7 @@ local function _get_nix_image_file_creation_time(image)
end
p:close()
else
dt.print(_("unable to get information for ") .. image.filename)
dt.print(string.format(_("unable to get information for %s"), image.filename))
datetime = ERROR
end
return datetime
@@ -314,7 +314,7 @@ local function reset_time(images)
image.exif_datetime_taken = get_original_image_time(image)
end
else
dt.print_error(_("reset time: no images selected"))
dt.print_error("reset time: no images selected")
dt.print(_("please select the images that need their time reset"))
end
end
@@ -430,8 +430,8 @@ end
img_time.widgets = {
-- name, type, tooltip, placeholder,
{"ayr", "combobox", _("years"), _("years to adjust by, 0 - ?"), {seq(0,20)}, 1},
{"amo", "combobox", _("months"), ("months to adjust by, 0-12"), {seq(0,12)}, 1},
{"ady", "combobox", _("days"), ("days to adjust by, 0-31"), {seq(0,31)}, 1},
{"amo", "combobox", _("months"), _("months to adjust by, 0-12"), {seq(0,12)}, 1},
{"ady", "combobox", _("days"), _("days to adjust by, 0-31"), {seq(0,31)}, 1},
{"ahr", "combobox", _("hours"), _("hours to adjust by, 0-23"), {seq(0,23)}, 1},
{"amn", "combobox", _("minutes"), _("minutes to adjust by, 0-59"), {seq(0,59)}, 1},
{"asc", "combobox", _("seconds"), _("seconds to adjust by, 0-59"), {seq(0,59)}, 1},
@@ -457,13 +457,13 @@ end
img_time.syr.selected = #img_time.syr
img_time.diff_entry = dt.new_widget("entry"){
tooltip = _("Time difference between images in seconds"),
placeholder = _("Select 2 images and use the calculate button"),
tooltip = _("time difference between images in seconds"),
placeholder = _("select 2 images and use the calculate button"),
text = "",
}
img_time.calc_btn = dt.new_widget("button"){
label = _("Calculate"),
label = _("calculate"),
tooltip = _("calculate time difference between 2 images"),
clicked_callback = function()
calculate_difference(dt.gui.action_images)

View File

@@ -73,13 +73,12 @@ script_data.show = nil -- only required for libs since the destroy_method only h
-- I 1 8 N
-- - - - - - - - - - - - - - - - - - - - - - - - - -
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain(MODULE, dt.configuration.config_dir .. "/lua/locale/")
gettext.bindtextdomain("jpg_group_leader", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE, msgid)
return gettext(msgid)
end
@@ -182,7 +181,7 @@ dt.register_event(MODULE .. "_collect", "shortcut",
local images = dt.collection
make_existing_jpg_group_leader(images)
end,
_("Make jpg group leader for collection")
_("make jpg group leader for collection")
)
dt.register_event(MODULE .. "_select", "shortcut",
@@ -190,7 +189,7 @@ dt.register_event(MODULE .. "_select", "shortcut",
local images = dt.gui.selection()
make_existing_jpg_group_leader(images)
end,
_("Make jpg group leader for selection")
_("make jpg group leader for selection")
)
return script_data

View File

@@ -39,7 +39,7 @@ local df = require "lib/dtutils.file"
local ds = require "lib/dtutils.string"
local dsys = require "lib/dtutils.system"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
@@ -54,15 +54,14 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("kml_export",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("kml_export", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("kml_export", msgid)
return gettext(msgid)
end
local function show_status(storage, image, format, filename, number, total, high_quality, extra_data)
dt.print(string.format(_("Export Image %i/%i"), number, total))
dt.print(string.format(_("export image %i/%i"), number, total))
end
-- Add duplicate index to filename
@@ -320,14 +319,14 @@ if dt.configuration.running_os == "windows" then
"OpenKmlFile",
"bool",
_("KML export: Open KML file after export"),
_("Opens the KML file after the export with the standard program for KML files"),
_("opens the KML file after the export with the standard program for KML files"),
false )
else
dt.preferences.register("kml_export",
"OpenKmlFile",
"bool",
_("KML export: Open KML/KMZ file after export"),
_("Opens the KML file after the export with the standard program for KML files"),
_("KML export: open KML/KMZ file after export"),
_("opens the KML file after the export with the standard program for KML files"),
false )
end
@@ -346,23 +345,23 @@ end
dt.preferences.register("kml_export",
"ExportDirectory",
"directory",
_("KML export: Export directory"),
_("A directory that will be used to export the KML/KMZ files"),
_("KML export: export directory"),
_("a directory that will be used to export the KML/KMZ files"),
defaultDir )
if dt.configuration.running_os ~= "linux" then
dt.preferences.register("kml_export",
"magickPath", -- name
"file", -- type
_("KML export: ImageMagick binary Location"), -- label
_("Install location of magick[.exe]. Requires restart to take effect."), -- tooltip
_("KML export: ImageMagick binary location"), -- label
_("install location of magick[.exe], requires restart to take effect"), -- tooltip
"magick") -- default
end
dt.preferences.register("kml_export",
"CreatePath",
"bool",
_("KML export: Connect images with path"),
_("KML export: connect images with path"),
_("connect all images with a path"),
false )
@@ -370,16 +369,16 @@ if dt.configuration.running_os == "linux" then
dt.preferences.register("kml_export",
"CreateKMZ",
"bool",
_("KML export: Create KMZ file"),
_("Compress all imeges to one KMZ file"),
_("KML export: create KMZ file"),
_("compress all imeges to one KMZ file"),
true )
end
-- Register
if dt.configuration.running_os == "windows" then
dt.register_storage("kml_export", _("KML Export"), nil, create_kml_file)
dt.register_storage("kml_export", _("KML export"), nil, create_kml_file)
else
dt.register_storage("kml_export", _("KML/KMZ Export"), nil, create_kml_file)
dt.register_storage("kml_export", _("KML/KMZ export"), nil, create_kml_file)
end
script_data.destroy = destroy

View File

@@ -37,15 +37,14 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("2.0.0", "passport_guide")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("passport_guide",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("passport_guide", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("passport_guide", msgid)
return gettext(msgid)
end
dt.guides.register_guide("passport",

View File

@@ -42,17 +42,16 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("pdf_slideshow",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("pdf_slideshow", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("pdf_slideshow", msgid)
return gettext(msgid)
end
if not df.check_if_bin_exists("pdflatex") then
dt.print_error(_("pdflatex not found"))
dt.print_error("pdflatex not found")
return
end
@@ -231,7 +230,7 @@ dt.register_storage("pdf_slideshow",_("pdf slideshow"),
local result = dt.control.execute(command)
if result ~= 0 then
dt.print(_("problem running pdflatex")) -- this one is probably usefull to the user
error(_("problem running ")..command)
error("problem running ")..command)
end
-- open the PDF
@@ -241,7 +240,7 @@ dt.register_storage("pdf_slideshow",_("pdf slideshow"),
local result = dt.control.execute(command)
if result ~= 0 then
dt.print(_("problem running pdf viewer")) -- this one is probably usefull to the user
error(_("problem running ")..command)
error("problem running "..command)
end
-- finally do some clean-up

View File

@@ -55,9 +55,7 @@ script_data.show = nil -- only required for libs since the destroy_method only h
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
local gettext = dt.gettext
gettext.bindtextdomain(MODULE_NAME,
dt.configuration.config_dir .. PS .. "lua" .. PS .. "locale" .. PS)
local gettext = dt.gettext.gettext
local exporter = dt.new_format("jpeg")
exporter.quality = 80
@@ -66,8 +64,10 @@ exporter.max_width = 224
-- helper functions
gettext.bindtextdomain("photils", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE_NAME, msgid)
return gettext(msgid)
end
local function num_keys(tbl)
@@ -178,7 +178,7 @@ function PHOTILS.image_changed()
end
function PHOTILS.tagged_image_has_changed()
GUI.warning.label = _("The suggested tags were not generated\n for the currently selected image!")
GUI.warning.label = _("the suggested tags were not generated\n for the currently selected image!")
end
function PHOTILS.paginate()
@@ -235,7 +235,7 @@ end
function PHOTILS.attach_tags()
local num_selected = #dt.gui.selection()
local job = dt.gui.create_job(_("Apply tag to image"), true)
local job = dt.gui.create_job(_("apply tag to image"), true)
for i = 1, num_selected, 1 do
local image = dt.gui.selection()[i]
@@ -247,7 +247,7 @@ function PHOTILS.attach_tags()
job.percent = i / num_selected
end
dt.print(_("Tags successfully attached to image"))
dt.print(_("tags successfully attached to image"))
job.valid = false
end
@@ -313,11 +313,11 @@ function PHOTILS.on_tags_clicked()
local images = dt.gui.selection()
if #images == 0 then
dt.print(_("No image selected."))
dt.print(_("no image selected."))
dt.control.sleep(2000)
else
if #images > 1 then
dt.print(_("This plugin can only handle a single image."))
dt.print(_("this plugin can only handle a single image."))
dt.gui.selection({images[1]})
dt.control.sleep(2000)
end
@@ -428,9 +428,9 @@ end
if not photils_installed then
GUI.warning_label.label = _("photils-cli not found")
dt.print_log(_("photils-cli not found"))
dt.print_log("photils-cli not found")
else
GUI.warning_label.label = _("Select an image, click \"get tags\" and get \nsuggestions for tags.")
GUI.warning_label.label = _("select an image, click \"get tags\" and get \nsuggestions for tags.")
end
GUI.pagination = dt.new_widget("box") {
@@ -473,9 +473,9 @@ dt.preferences.register(MODULE_NAME,
"export_image_before_for_tags",
"bool",
_("photils: use exported image for tag request"),
_("If enabled, the image passed to photils for tag suggestion is based on the exported, already edited image. " ..
"Otherwise, the embedded thumbnail of the RAW file will be used for tag suggestion." ..
"The embedded thumbnail could speedup the tag suggestion but can fail if the RAW file is not supported."),
_("if enabled, the image passed to photils for tag suggestion is based on the exported, already edited image. " ..
"otherwise, the embedded thumbnail of the RAW file will be used for tag suggestion." ..
"the embedded thumbnail could speedup the tag suggestion but can fail if the RAW file is not supported."),
true)
dt.register_event("photils", "mouse-over-image-changed",

View File

@@ -62,13 +62,12 @@ qt.module_installed = false
qt.event_registered = false
qt.widget_table = {}
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("quicktag",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("quicktag", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("quicktag", msgid)
return gettext(msgid)
end
-- maximum length of button labels

View File

@@ -44,6 +44,14 @@ local du = require "lib/dtutils"
-- added version check
du.check_min_api_version("7.0.0", "rate_group")
local gettext = dt.gettext.gettext
gettext.bindtextdomain("rate_group", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext(msgid)
end
-- return data structure for script_manager
local script_data = {}
@@ -62,9 +70,9 @@ local function apply_rating(rating)
end
end
if rating < 0 then
dt.print("rejecting group(s)")
dt.print(_("rejecting group(s)"))
else
dt.print("applying rating " ..rating.. " to group(s)")
dt.print(string.format(_("applying rating %d to group(s)"), rating))
end
end
@@ -81,37 +89,37 @@ end
dt.register_event("rg_reject", "shortcut",
function(event, shortcut)
apply_rating(-1)
end, "Reject group")
end, _("reject group"))
dt.register_event("rg0", "shortcut",
function(event, shortcut)
apply_rating(0)
end, "Rate group 0")
end, _("rate group 0"))
dt.register_event("rg1", "shortcut",
function(event, shortcut)
apply_rating(1)
end, "Rate group 1")
end, _("rate group 1"))
dt.register_event("rg2", "shortcut",
function(event, shortcut)
apply_rating(2)
end, "Rate group 2")
end, _("rate group 2"))
dt.register_event("rg3", "shortcut",
function(event, shortcut)
apply_rating(3)
end, "Rate group 3")
end, _("rate group 3"))
dt.register_event("rg4", "shortcut",
function(event, shortcut)
apply_rating(4)
end, "Rate group 4")
end, _("rate group 4"))
dt.register_event("rg5", "shortcut",
function(event, shortcut)
apply_rating(5)
end, "Rate group 5")
end, _("rate group 5"))
script_data.destroy = destroy

View File

@@ -36,6 +36,14 @@ local debug = require "darktable.debug"
du.check_min_api_version("7.0.0", "rename-tags")
du.deprecated("contrib/rename-tags.lua","darktable release 4.0")
local gettext = dt.gettext.gettext
gettext.bindtextdomain("rename-tags", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext(msgid)
end
-- return data structure for script_manager
local script_data = {}
@@ -50,8 +58,8 @@ rt.module_installed = false
rt.event_registered = false
-- GUI entries
local old_tag = darktable.new_widget("entry") { tooltip = "Enter old tag" }
local new_tag = darktable.new_widget("entry") { tooltip = "Enter new tag" }
local old_tag = darktable.new_widget("entry") { tooltip = _("enter old tag") }
local new_tag = darktable.new_widget("entry") { tooltip = _("enter new tag") }
local function rename_reset()
old_tag.text = ''
@@ -62,11 +70,11 @@ end
local function rename_tags()
-- If entries are empty, return
if old_tag.text == '' then
darktable.print ("Old tag can't be empty")
darktable.print (_("old tag can't be empty"))
return
end
if new_tag.text == '' then
darktable.print ("New tag can't be empty")
darktable.print (_("new tag can't be empty"))
return
end
@@ -76,12 +84,12 @@ local function rename_tags()
local ot = darktable.tags.find (old_tag.text)
if not ot then
darktable.print ("Old tag does not exist")
darktable.print (_("old tag does not exist"))
return
end
-- Show job
local job = darktable.gui.create_job ("Renaming tag", true)
local job = darktable.gui.create_job (_("renaming tag"), true)
old_tag.editable = false
new_tag.editable = false
@@ -104,7 +112,7 @@ local function rename_tags()
darktable.tags.delete (ot)
job.valid = false
darktable.print ("Renamed tags for " .. count .. " images")
darktable.print (string.format(_("renamed tags for %d images"), count))
old_tag.editable = true
new_tag.editable = true
@@ -115,7 +123,7 @@ end
local function install_module()
if not rt.module_installed then
darktable.register_lib ("rename_tags", "rename tag", true, true, {[darktable.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 20},}, rt.rename_widget, nil, nil)
darktable.register_lib ("rename_tags", _("rename tag"), true, true, {[darktable.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 20},}, rt.rename_widget, nil, nil)
rt.module_installed = true
end
end
@@ -131,13 +139,13 @@ end
-- GUI
local old_widget = darktable.new_widget ("box") {
orientation = "horizontal",
darktable.new_widget("label") { label = "Old tag" },
darktable.new_widget("label") { label = _("old tag") },
old_tag
}
local new_widget = darktable.new_widget ("box") {
orientation = "horizontal",
darktable.new_widget("label") { label = "New tag" },
darktable.new_widget("label") { label = _("new tag") },
new_tag
}
@@ -146,7 +154,7 @@ rt.rename_widget = darktable.new_widget ("box") {
reset_callback = rename_reset,
old_widget,
new_widget,
darktable.new_widget("button") { label = "Go", clicked_callback = rename_tags }
darktable.new_widget("button") { label = _("go"), clicked_callback = rename_tags }
}
if darktable.gui.current_view().id == "lighttable" then

View File

@@ -46,13 +46,12 @@ local df = require "lib/dtutils.file"
du.check_min_api_version("7.0.0", "rename_images")
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("rename_images",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("rename_images", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("rename_images", msgid)
return gettext(msgid)
end
-- namespace variable
@@ -86,7 +85,7 @@ local MODULE_NAME = "rename_images"
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
local USER = os.getenv("USERNAME")
local HOME = os.getenv(dt.configuration.running_os == "windows" and "HOMEPATH" or "HOME")
local PICTURES = HOME .. PS .. dt.configuration.running_os == "windows" and "My Pictures" or "Pictures"
local PICTURES = HOME .. PS .. dt.configuration.running_os == "windows" and _("My Pictures") or _("Pictures")
local DESKTOP = HOME .. PS .. "Desktop"
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -158,8 +157,8 @@ local function substitute_list(str)
if rename.substitutes[var] then
str = string.gsub(str, "%$%("..var.."%)", rename.substitutes[var])
else
dt.print_error(_("unrecognized variable " .. var))
dt.print(_("unknown variable " .. var .. ", aborting..."))
dt.print_error("unrecognized variable " .. var)
dt.print(string.format(_("unknown variable %s, aborting..."), var))
return -1
end
end
@@ -210,7 +209,7 @@ local function do_rename(images)
if #images > 0 then
local pattern = rename.widgets.pattern.text
dt.preferences.write(MODULE_NAME, "pattern", "string", pattern)
dt.print_log(_("pattern is " .. pattern))
dt.print_log("pattern is " .. pattern)
if string.len(pattern) > 0 then
local datetime = os.date("*t")
@@ -250,7 +249,7 @@ local function do_rename(images)
stop_job(job)
local collect_rules = dt.gui.libs.collect.filter()
dt.gui.libs.collect.filter(collect_rules)
dt.print(_("renamed " .. #images .. " images"))
dt.print(string.format(_("renamed %d images"), #images))
else -- pattern length
dt.print_error("no pattern supplied, returning...")
dt.print(_("please enter the new name or pattern"))

View File

@@ -29,11 +29,12 @@ du.check_min_api_version("9.1.0", MODULE)
-- figure out the path separator
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
local gettext = dt.gettext
gettext.bindtextdomain(MODULE, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
local gettext = dt.gettext.gettext
gettext.bindtextdomain("select_non_existing", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE, msgid)
return gettext(msgid)
end
local function stop_job(job)

View File

@@ -20,7 +20,7 @@ Enable selection of untagged images (darktable|* tags are ignored)
local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "select_untagged")
@@ -33,11 +33,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("select_untagged",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("select_untagged", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("select_untagged", msgid)
return gettext(msgid)
end
local function stop_job(job)

View File

@@ -27,7 +27,7 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "slideshowMusic")
@@ -40,11 +40,10 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("slideshowMusic",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("slideshowMusic", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("slideshowMusic", msgid)
return gettext(msgid)
end
local function playSlideshowMusic(_, old_view, new_view)
@@ -54,7 +53,7 @@ local function playSlideshowMusic(_, old_view, new_view)
playMusic = dt.preferences.read("slideshowMusic","PlaySlideshowMusic","bool")
if not df.check_if_bin_exists("rhythmbox-client") then
dt.print_error(_("rhythmbox-client not found"))
dt.print_error("rhythmbox-client not found")
return
end
@@ -70,7 +69,7 @@ local function playSlideshowMusic(_, old_view, new_view)
if (old_view and old_view.id == "slideshow") then
stopCommand = "rhythmbox-client --pause"
--dt.print_error(stopCommand)
dt.control.execute( stopCommand)
dt.control.execute(stopCommand)
end
end
end
@@ -83,12 +82,12 @@ function destroy()
end
-- Preferences
dt.preferences.register("slideshowMusic", "SlideshowMusic", "file", _("Slideshow background music file"), "", "")
dt.preferences.register("slideshowMusic", "SlideshowMusic", "file", _("slideshow background music file"), "", "")
dt.preferences.register("slideshowMusic",
"PlaySlideshowMusic",
"bool",
_("Play slideshow background music"),
_("Plays music with rhythmbox if a slideshow starts"),
_("play slideshow background music"),
_("plays music with rhythmbox if a slideshow starts"),
true)
-- Register
dt.register_event("slideshow_music", "view-changed",

View File

@@ -96,10 +96,10 @@ local PATH_SEGMENT_REGEX = "(" .. PATH_SEPARATOR .. "?)([^" .. PATH_SEPARATOR ..
unpack = unpack or table.unpack
gmatch = string.gfind or string.gmatch
darktable.gettext.bindtextdomain(LIB_ID, darktable.configuration.config_dir .. PATH_SEPARATOR .. "lua" .. PATH_SEPARATOR .. "locale" .. PATH_SEPARATOR)
gettext.bindtextdomain("transfer_hierarchy", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return darktable.gettext.dgettext(LIB_ID, msgid)
return darktable.gettext.gettext(msgid)
end
-- Header material: END
@@ -151,7 +151,7 @@ end
-- Widgets and business logic: BEGIN
local sourceTextBox = darktable.new_widget("entry") {
tooltip = _("Lowest directory containing all selected images"),
tooltip = _("lowest directory containing all selected images"),
editable = false
}
sourceTextBox.reset_callback = function() sourceTextBox.text = "" end
@@ -268,17 +268,17 @@ local function doTransfer(transferFunc)
films[film] = destBase .. string.sub(film.path, #sourceBase+1)
if not pathExists(films[film]) then
if createDirectory(films[film]) == nil then
darktable.print(_("transfer hierarchy: ERROR: could not create directory: " .. films[film]))
darktable.print(string.format(_("transfer hierarchy: ERROR: could not create directory: %s"), films[film]))
return
end
end
if not pathIsDirectory(films[film]) then
darktable.print(_("transfer hierarchy: ERROR: not a directory: " .. films[film]))
darktable.print(string.format(_("transfer hierarchy: ERROR: not a directory: %s"), films[film]))
return
end
destFilms[film] = darktable.films.new(films[film])
if destFilms[film] == nil then
darktable.print(_("transfer hierarchy: ERROR: could not create film: " .. film.path))
darktable.print(string.format(_("transfer hierarchy: ERROR: could not create film: %s"), film.path))
end
end
@@ -287,7 +287,7 @@ local function doTransfer(transferFunc)
srcFilms[img] = img.film
end
local job = darktable.gui.create_job(string.format(_("transfer hierarchy") .. " (%d image" .. (#(darktable.gui.action_images) == 1 and "" or "s") .. ")", #(darktable.gui.action_images)), true, stopTransfer)
local job = darktable.gui.create_job(string.format(_("transfer hierarchy (%d image%s)"), #(darktable.gui.action_images), (#(darktable.gui.action_images) == 1 and "" or "s")), true, stopTransfer)
job.percent = 0.0
local pctIncrement = 1.0 / #(darktable.gui.action_images)
for _,img in ipairs(darktable.gui.action_images) do

View File

@@ -37,7 +37,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local dsys = require "lib/dtutils.system"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "video_ffmpeg")
@@ -53,10 +53,11 @@ script_data.show = nil -- only required for libs since the destroy_method only h
local MODULE_NAME = "video_ffmpeg"
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
gettext.bindtextdomain(MODULE_NAME, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
gettext.bindtextdomain("video_ffmpeg", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE_NAME, msgid)
return gettext(msgid)
end
@@ -294,7 +295,7 @@ else
end
local output_directory_chooser = dt.new_widget("file_chooser_button"){
title = _("Select export path"),
title = _("select export path"),
is_directory = true,
tooltip =_("select the target directory for the timelapse. \nthe filename is created automatically."),
value = string_pref_read("export_path", defaultVideoDir),
@@ -375,7 +376,7 @@ local module_widget = dt.new_widget("box") {
---- EXPORT & REGISTRATION
local function show_status(enf_storage, image, format, filename, number, total, high_quality, extra_data)
dt.print(_("export ")..tostring(number).." / "..tostring(total))
dt.print(string.format(_("export %d / %d"), number), total))
end
local function init_export(storage, img_format, images, high_quality, extra_data)
@@ -465,7 +466,7 @@ end
dt.register_storage(
"module_video_ffmpeg",
_(MODULE_NAME),
_("video ffmpeg"),
show_status,
finalize_export,
nil,

View File

@@ -23,6 +23,16 @@ USAGE
]]
local dt = require "darktable"
-- translation facilities
local gettext = dt.gettext.gettext
gettext.bindtextdomain("api_version", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
-- script_manager integration to allow a script to be removed
-- without restarting darktable
local function destroy()
@@ -30,7 +40,8 @@ local function destroy()
end
local result = dt.configuration.api_version_string
dt.print_error("API Version: "..result)
dt.print_log("API Version: " .. result)
dt.print(string.format(_("API version: %s"), result))
-- set the destroy routine so that script_manager can call it when
-- it's time to destroy the script and then return the data to

View File

@@ -40,7 +40,7 @@ local du = require "lib/dtutils"
-- V E R S I O N C H E C K
-- - - - - - - - - - - - - - - - - - - - - - - -
du.check_min_api_version("5.0.2", "darkroom_mode") -- darktable 3.0
du.check_min_api_version("5.0.2", "darkroom_demo") -- darktable 3.0
-- script_manager integration to allow a script to be removed
-- without restarting darktable
@@ -52,17 +52,18 @@ end
-- C O N S T A N T S
-- - - - - - - - - - - - - - - - - - - - - - - -
local MODULE_NAME = "darkroom"
local MODULE_NAME = "darkroom_demo"
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
-- - - - - - - - - - - - - - - - - - - - - - - -
-- T R A N S L A T I O N S
-- - - - - - - - - - - - - - - - - - - - - - - -
local gettext = dt.gettext
gettext.bindtextdomain(MODULE_NAME, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
local gettext = dt.gettext.gettext
gettext.bindtextdomain("darkroom_demo", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE_NAME, msgid)
return gettext(msgid)
end
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -92,13 +93,13 @@ dt.gui.current_view(dt.gui.views.darkroom)
local max_images = 10
dt.print(_("Showing images, with a pause in between each"))
dt.print(_("showing images, with a pause in between each"))
sleep(1500)
-- display first 10 images of collection pausing for a second between each
for i, img in ipairs(dt.collection) do
dt.print(_("Displaying image " .. i))
dt.print(string.format(_("displaying image "), i))
dt.gui.views.darkroom.display_image(img)
sleep(1500)
if i == max_images then
@@ -108,7 +109,7 @@ end
-- return to lighttable view
dt.print(_("Restoring view"))
dt.print(_("restoring view"))
sleep(1500)
dt.gui.current_view(current_view)

View File

@@ -67,22 +67,20 @@ end
-- Not translated Text
dt.print_error("Hello World!")
local gettext = dt.gettext
local gettext = dt.gettext.gettext
gettext.bindtextdomain("gettextExample", dt.configuration.config_dir .."/lua/locale/")
-- Translate a string using the darktable textdomain
dt.print_error(gettext.gettext("image"))
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("gettextExample",dt.configuration.config_dir.."/lua/locale/")
-- Translate a string using the specified textdomain
dt.print_error(gettext.dgettext("gettextExample", 'Hello World!'))
dt.print_error(gettext("image"))
-- Define a local function called _ to make the code more readable and have it call dgettext
-- with the proper domain.
local function _(msgid)
return gettext.dgettext("gettextExample", msgid)
return gettext(msgid)
end
dt.print_error(_('Hello World!'))
dt.print_error(_("hello world!"))
-- set the destroy routine so that script_manager can call it when
-- it's time to destroy the script and then return the data to

View File

@@ -29,15 +29,25 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
-- translation facilities
du.check_min_api_version("2.0.0", "hello_world")
local gettext = dt.gettext.gettext
gettext.bindtextdomain("hello_world", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
-- script_manager integration to allow a script to be removed
-- without restarting darktable
local function destroy()
-- nothing to destroy
end
dt.print("hello, world")
dt.print(_("hello, world"))
-- set the destroy routine so that script_manager can call it when
-- it's time to destroy the script and then return the data to

View File

@@ -59,11 +59,12 @@ end
-- - - - - - - - - - - - - - - - - - - - - - - -
-- T R A N S L A T I O N S
-- - - - - - - - - - - - - - - - - - - - - - - -
local gettext = dt.gettext
gettext.bindtextdomain(MODULE_NAME, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
local gettext = dt.gettext.gettext
gettext.bindtextdomain("lighttable_demo", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE_NAME, msgid)
return gettext(msgid)
end
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -145,17 +146,17 @@ sleep(2000)
for n, layout in ipairs(layouts) do
dt.gui.libs.lighttable_mode.layout(layout)
dt.print(_("set lighttable layout to " .. layout))
dt.print_log(_("set lighttable layout to " .. layout))
dt.print(string.format(_("set lighttable layout to %s"), layout))
dt.print_log("set lighttable layout to " .. layout)
sleep(1500)
for i = 1, 10 do
dt.gui.libs.lighttable_mode.zoom_level(i)
dt.print(_("Set zoom level to " .. i))
dt.print(string.format(_("set zoom level to %d"), i))
sleep(1500)
end
for i = 9, 1, -1 do
dt.gui.libs.lighttable_mode.zoom_level(i)
dt.print(_("Set zoom level to " .. i))
dt.print(string.format(_("set zoom level to %d"), i))
sleep(1500)
end
end
@@ -174,12 +175,12 @@ dt.print_log("starting sorts")
for n, sort in ipairs(sorts) do
dt.gui.libs.filter.sort(sort)
dt.print(_("set lighttable sort to " .. sort))
dt.print(string.format(_("set lighttable sort to %s"), sort))
sleep(1500)
for m, sort_order in ipairs(sort_orders) do
dt.gui.libs.filter.sort_order(sort_order)
dt.print(_("sort order set to " .. sort_order))
dt.print(string.format(_("sort order set to %s"), sort_order))
sleep(1500)
end
end
@@ -190,12 +191,12 @@ dt.print(_("lighttable filtering demonstration"))
for n, rating in ipairs(ratings) do
dt.gui.libs.filter.rating(rating)
dt.print(_("set filter to " .. rating))
dt.print(string.format(_("set filter to %s"), rating))
sleep(1500)
for m, rating_comparator in ipairs(rating_comparators) do
dt.gui.libs.filter.rating_comparator(rating_comparator)
dt.print(_("set rating comparator to " .. rating_comparator))
dt.print(string.format(_("set rating comparator to %s"), rating_comparator))
sleep(1500)
end
end

View File

@@ -47,12 +47,12 @@ script_data.show = nil -- only required for libs since the destroy_method only h
-- translation
-- https://www.darktable.org/lua-api/index.html#darktable_gettext
local gettext = dt.gettext
local gettext = dt.gettext.gettext
gettext.bindtextdomain("moduleExample", dt.configuration.config_dir .. "/lua/locale/")
gettext.bindtextdomain("moduleExample", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("moduleExample", msgid)
return gettext(msgid)
end
-- declare a local namespace and a couple of variables we'll need to install the module
@@ -80,9 +80,9 @@ local function install_module()
orientation = "vertical",
dt.new_widget("button")
{
label = _("MyButton"),
label = _("my button"),
clicked_callback = function (_)
dt.print(_("Button clicked"))
dt.print(_("button clicked"))
end
},
table.unpack(mE.widgets),
@@ -105,10 +105,10 @@ local function restart()
end
-- https://www.darktable.org/lua-api/types_lua_check_button.html
local check_button = dt.new_widget("check_button"){label = _("MyCheck_button"), value = true}
local check_button = dt.new_widget("check_button"){label = _("my check_button"), value = true}
-- https://www.darktable.org/lua-api/types_lua_combobox.html
local combobox = dt.new_widget("combobox"){label = _("MyCombobox"), value = 2, "8", "16", "32"}
local combobox = dt.new_widget("combobox"){label = _("my combobox"), value = 2, "8", "16", "32"}
-- https://www.darktable.org/lua-api/types_lua_entry.html
local entry = dt.new_widget("entry")
@@ -117,21 +117,21 @@ local entry = dt.new_widget("entry")
placeholder = _("placeholder"),
is_password = false,
editable = true,
tooltip = _("Tooltip Text"),
tooltip = _("tooltip text"),
reset_callback = function(self) self.text = "text" end
}
-- https://www.darktable.org/lua-api/types_lua_file_chooser_button.html
local file_chooser_button = dt.new_widget("file_chooser_button")
{
title = _("MyFile_chooser_button"), -- The title of the window when choosing a file
title = _("my file_chooser_button"), -- The title of the window when choosing a file
value = "", -- The currently selected file
is_directory = false -- True if the file chooser button only allows directories to be selecte
}
-- https://www.darktable.org/lua-api/types_lua_label.html
local label = dt.new_widget("label")
label.label = _("MyLabel") -- This is an alternative way to the "{}" syntax to set a property
label.label = _("my label") -- This is an alternative way to the "{}" syntax to set a property
-- https://www.darktable.org/lua-api/types_lua_separator.html
local separator = dt.new_widget("separator"){}
@@ -139,7 +139,7 @@ local separator = dt.new_widget("separator"){}
-- https://www.darktable.org/lua-api/types_lua_slider.html
local slider = dt.new_widget("slider")
{
label = _("MySlider"),
label = _("my slider"),
soft_min = 10, -- The soft minimum value for the slider, the slider can't go beyond this point
soft_max = 100, -- The soft maximum value for the slider, the slider can't go beyond this point
hard_min = 0, -- The hard minimum value for the slider, the user can't manually enter a value beyond this point

View File

@@ -70,13 +70,12 @@ local dtsys = require "lib/dtutils.system" -- system utilities
translations, inserting this lays the groundwork for anyone who wants to translate the strings.
]]
local gettext = dt.gettext
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("multi_os",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("multi_os", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("multi_os", msgid)
return gettext(msgid)
end
--[[
@@ -187,12 +186,12 @@ local function extract_embedded_jpeg(images)
end
else
dt.print_error(image.filename .. " is not a raw file. No image can be extracted") -- print debugging error message
dt.print(image.filename .. " is not a raw file. No image can be extracted") -- print the error to the screen
dt.print(string.format(_("%s is not a raw file, no image can be extracted"), image.filename)) -- print the error to the screen
end
end
else
dt.print_error("ufraw-batch not found. Exiting...") -- print debugging error message
dt.print("ufraw-batch not found. Exiting...") -- print the error to the screen
dt.print("ufraw-batch not found, exiting...") -- print the error to the screen
end
end
@@ -216,7 +215,7 @@ end
if dt.configuration.running_os ~= "linux" then
local executable = "ufraw-batch"
local ufraw_batch_path_widget = dt.new_widget("file_chooser_button"){
title = _("Select ufraw-batch[.exe] executable"),
title = _("select ufraw-batch[.exe] executable"),
value = df.get_executable_path_preference(executable),
is_directory = false,
changed_callback = function(self)
@@ -228,7 +227,7 @@ if dt.configuration.running_os ~= "linux" then
dt.preferences.register("executable_paths", "ufraw-batch", -- name
"file", -- type
_('multi_os: ufraw-batch location'), -- label
_('Installed location of ufraw-batch. Requires restart to take effect.'), -- tooltip
_('Installed location of ufraw-batch, requires restart to take effect.'), -- tooltip
"ufraw-batch", -- default
ufraw_batch_path_widget
)
@@ -241,7 +240,7 @@ end
dt.gui.libs.image.register_action(
"multi_os", _("extract embedded jpeg"),
function(event, images) extract_embedded_jpeg(images) end,
"extract embedded jpeg"
_("extract embedded jpeg")
)
--[[
@@ -251,7 +250,7 @@ dt.gui.libs.image.register_action(
dt.register_event(
"multi_os", "shortcut",
function(event, shortcut) extract_embedded_jpeg(dt.gui.action_images) end,
"extract embedded jpeg"
_("extract embedded jpeg")
)
--[[

View File

@@ -53,17 +53,18 @@ end
-- C O N S T A N T S
-- - - - - - - - - - - - - - - - - - - - - - - -
local MODULE_NAME = "panels"
local MODULE_NAME = "panels_demo"
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
-- - - - - - - - - - - - - - - - - - - - - - - -
-- T R A N S L A T I O N S
-- - - - - - - - - - - - - - - - - - - - - - - -
local gettext = dt.gettext
gettext.bindtextdomain(MODULE_NAME, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
local gettext = dt.gettext.gettext
gettext.bindtextdomain("panels_demo", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext(MODULE_NAME, msgid)
return gettext(msgid)
end
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -94,29 +95,29 @@ dt.gui.panel_show_all()
-- hide center_top, center_bottom, left, top, right, bottom in order
dt.print(_("Hiding all panels, one at a tme"))
dt.print(_("hiding all panels, one at a tme"))
sleep(1500)
for i = 1, #panels do
dt.print(_("Hiding " .. panels[i]))
dt.print(_("hiding " .. panels[i]))
dt.gui.panel_hide(panels[i])
sleep(1500)
end
-- display left, then top, then right, then bottom
dt.print(_("Make panels visible, one at a time"))
dt.print(_("make panels visible, one at a time"))
sleep(1500)
for i = #panels, 1, -1 do
dt.print(_("Showing " .. panels[i]))
dt.print(_("showing " .. panels[i]))
dt.gui.panel_show(panels[i])
sleep(1500)
end
-- hide all
dt.print(_("Hiding all panels"))
dt.print(_("hiding all panels"))
sleep(1500)
dt.gui.panel_hide_all()
@@ -124,7 +125,7 @@ sleep(1500)
-- show all
dt.print(_("Showing all panels"))
dt.print(_("showing all panels"))
sleep(1500)
dt.gui.panel_show_all()
@@ -132,7 +133,7 @@ sleep(1500)
-- restore
dt.print(_("Restoring panels to starting configuration"))
dt.print(_("restoring panels to starting configuration"))
for i = 1, #panels do
if panel_status[i] then
dt.gui.panel_show(panels[i])

View File

@@ -24,28 +24,38 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
-- translation facilities
local gettext = dt.gettext.gettext
gettext.bindtextdomain("preferenceExamples", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
du.check_min_api_version("2.0.1", "preferenceExamples")
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
"preferenceExamplesString", -- name
"string", -- type
"Example String", -- label
"Example String Tooltip", -- tooltip
_("example string"), -- label
_("example string tooltip"), -- tooltip
"String") -- default
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
"preferenceExamplesBool", -- name
"bool", -- type
"Example Boolean", -- label
"Example Boolean Tooltip", -- tooltip
_("example boolean"), -- label
_("example boolean tooltip"), -- tooltip
true) -- default
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
"preferenceExamplesInteger", -- name
"integer", -- type
"Example Integer", -- label
"Example Integer Tooltip", -- tooltip
_("example integer"), -- label
_("example integer tooltip"), -- tooltip
2, -- default
1, -- min
99) -- max
@@ -53,8 +63,8 @@ dt.preferences.register("preferenceExamples", -- script: This is a string
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
"preferenceExamplesFloat", -- name
"float", -- type
"Example Float", -- label
"Example Float Tooltip", -- tooltip
_("example float"), -- label
_("example float tooltip"), -- tooltip
1.3, -- default
1, -- min
99, -- max
@@ -63,22 +73,22 @@ dt.preferences.register("preferenceExamples", -- script: This is a string
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
"preferenceExamplesFile", -- name
"file", -- type
"Example File", -- label
"Example File Tooltip", -- tooltip
_("example file"), -- label
_("example file tooltip"), -- tooltip
"") -- default
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
"preferenceExamplesDirectory", -- name
"directory", -- type
"Example Directory", -- label
"Example Directory Tooltip", -- tooltip
_("example directory"), -- label
_("example directory tooltip"), -- tooltip
"") -- default
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
"preferenceExamplesEnum", -- name
"enum", -- type
"Example Enum", -- label
"Example Enum Tooltip", -- tooltip
_("example enum"), -- label
_("example enum tooltip"), -- tooltip
"Enum 1", -- default
"Enum 1", "Enum 2") -- values

View File

@@ -24,6 +24,16 @@ local du = require "lib/dtutils"
du.check_min_api_version("5.0.0", "printExamples")
-- translation facilities
local gettext = dt.gettext.gettext
gettext.bindtextdomain("printExamples", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
-- script_manager integration to allow a script to be removed
-- without restarting darktable
local function destroy()
@@ -32,7 +42,7 @@ end
-- Will print a string to the darktable control log (the long
-- overlayed window that appears over the main panel).
dt.print("print")
dt.print(_("print"))
-- This function will print its parameter if the Lua logdomain is
-- activated. Start darktable with the "-d lua" command line option

View File

@@ -30,13 +30,23 @@ local du = require "lib/dtutils"
du.check_min_api_version("5.0.0", "running_os")
-- translation facilities
local gettext = dt.gettext.gettext
gettext.bindtextdomain("running_os", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
-- script_manager integration to allow a script to be removed
-- without restarting darktable
local function destroy()
-- nothing to destroy
end
dt.print("You are running: "..dt.configuration.running_os)
dt.print(string.format(_("you are running: %s"), dt.configuration.running_os))
-- set the destroy routine so that script_manager can call it when
-- it's time to destroy the script and then return the data to

View File

@@ -27,7 +27,7 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "copy_paste_metadata")
@@ -58,11 +58,10 @@ local publisher = ""
local rights = ""
local tags = {}
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("copy_paste_metadata",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("copy_paste_metadata", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("copy_paste_metadata", msgid)
return gettext(msgid)
end
local function copy(image)
@@ -147,13 +146,13 @@ dt.gui.libs.image.register_action(
dt.register_event(
"capmd1", "shortcut",
function(event, shortcut) copy(dt.gui.action_images[1]) end,
"copy metadata"
_("copy metadata")
)
dt.register_event(
"capmd2", "shortcut",
function(event, shortcut) paste(dt.gui.action_images) end,
"paste metadata"
_("paste metadata")
)
script_data.destroy = destroy

View File

@@ -59,7 +59,7 @@ local long_tags = {}
for _,t in ipairs(dt.tags) do
local len = #t.name
if len > max_length then
print("deleting tag `"..t.name.."' (length: "..len..")")
dt.print_log("deleting tag `"..t.name.."' (length: "..len..")")
table.insert(long_tags, t.name)
end
end

View File

@@ -56,7 +56,7 @@ for _, t in ipairs(dt.tags) do
end
for _,name in pairs(unused_tags) do
print("deleting tag `" .. name .. "'")
dt.print_log("deleting tag `" .. name .. "'")
tag = dt.tags.find(name)
tag:delete()
end

View File

@@ -39,7 +39,7 @@ local dtsys = require "lib/dtutils.system"
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
local gettext = dt.gettext
local gettext = dt.gettext.gettext
du.check_min_api_version("7.0.0", "enfuse")
@@ -52,16 +52,15 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("enfuse",dt.configuration.config_dir..PS .. "lua" .. PS .. "locale" .. PS)
local enf = {}
enf.event_registered = false
enf.module_installed = false
enf.lib_widgets = {}
gettext.bindtextdomain("enfuse", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("enfuse", msgid)
return gettext(msgid)
end
local function install_module()
@@ -132,7 +131,7 @@ if enfuse_installed then
exposure_mu = dt.new_widget("slider")
{
label = "exposure mu",
tooltip = "center also known as MEAN of Gaussian weighting function (0 <= MEAN <= 1); default: 0.5",
tooltip = _("center also known as mean of gaussian weighting function (0 <= mean <= 1); default: 0.5"),
hard_min = 0,
hard_max = 1,
value = dt.preferences.read("enfuse", "exposure_mu", "float")
@@ -141,7 +140,7 @@ if enfuse_installed then
exposure_mu = dt.new_widget("slider")
{
label = "exposure optimum",
tooltip = "optimum exposure value, usually the maximum of the weighting function (0 <= OPTIMUM <=1); default 0.5",
tooltip = _("optimum exposure value, usually the maximum of the weighting function (0 <= optimum <=1); default 0.5"),
hard_min = 0,
hard_max = 1,
value = dt.preferences.read("enfuse", "exposure_optimum", "float")
@@ -151,7 +150,7 @@ if enfuse_installed then
local depth = dt.new_widget("combobox")
{
label = "depth",
tooltip = "the number of bits per channel of the output image",
tooltip = _("the number of bits per channel of the output image"),
value = dt.preferences.read("enfuse", "depth", "integer"),
changed_callback = function(w) dt.preferences.write("enfuse", "depth", "integer", w.selected) end,
"8", "16", "32"
@@ -160,14 +159,14 @@ if enfuse_installed then
local blend_colorspace = dt.new_widget("combobox")
{
label = "blend colorspace",
tooltip = "Force blending in selected colorspace",
tooltip = _("force blending in selected colorspace"),
changed_callback = function(w) dt.preferences.write("enfuse", "blend_colorspace", "string", w.selected) end,
"", "identity", "ciecam"
}
local enfuse_button = dt.new_widget("button")
{
label = enfuse_installed and "run enfuse" or "enfuse not installed",
label = enfuse_installed and _("run enfuse") or _("enfuse not installed"),
clicked_callback = function ()
-- remember exposure_mu
-- TODO: find a way to save it whenever the value changes
@@ -185,7 +184,7 @@ if enfuse_installed then
end
local f = io.open(response_file, "w")
if not f then
dt.print(string.format(_("Error writing to `%s`"), response_file))
dt.print(string.format(_("error writing to '%s'"), response_file))
os.remove(response_file)
return
end
@@ -208,9 +207,9 @@ if enfuse_installed then
if dt.configuration.running_os == "windows" then
tmp_exported = dt.configuration.tmp_dir .. tmp_exported -- windows os.tmpname() defaults to root directory
end
dt.print(string.format(_("Converting raw file '%s' to tiff..."), i.filename))
dt.print(string.format(_("converting raw file '%s' to tiff..."), i.filename))
tiff_exporter:write_image(i, tmp_exported, false)
dt.print_log(string.format("Raw file '%s' converted to '%s'", i.filename, tmp_exported))
dt.print_log(string.format("raw file '%s' converted to '%s'", i.filename, tmp_exported))
cnt = cnt + 1
f:write(tmp_exported.."\n")
@@ -218,14 +217,14 @@ if enfuse_installed then
-- other images will be skipped
else
dt.print(string.format(_("Skipping %s..."), i.filename))
dt.print(string.format(_("skipping %s..."), i.filename))
n_skipped = n_skipped + 1
end
end
f:close()
-- bail out if there is nothing to do
if cnt == 0 then
dt.print(_("No suitable images selected, nothing to do for enfuse"))
dt.print(_("no suitable images selected, nothing to do for enfuse"))
os.remove(response_file)
return
end
@@ -251,7 +250,7 @@ if enfuse_installed then
..blend_colorspace_option
.." -o \""..output_image.."\" \"@"..response_file.."\""
if dtsys.external_command( command) > 0 then
dt.print(_("Enfuse failed, see terminal output for details"))
dt.print(_("enfuse failed, see terminal output for details"))
os.remove(response_file)
return
end
@@ -299,7 +298,7 @@ if enfuse_installed then
else
dt.print_error("enfuse executable not found")
error("enfuse executable not found")
dt.print(_("Could not find enfuse executable. Not loading enfuse exporter..."))
dt.print(_("could not find enfuse executable, not loading enfuse exporter..."))
end
script_data.destroy = destroy

View File

@@ -38,6 +38,14 @@ local dt = require "darktable"
local du = require "lib/dtutils"
require "darktable.debug"
local gettext = dt.gettext.gettext
gettext.bindtextdomain("generate_image_txt", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
du.check_min_api_version("7.0.0", "generate_image_txt")
-- return data structure for script_manager
@@ -52,21 +60,21 @@ script_data.show = nil -- only required for libs since the destroy_method only h
dt.preferences.register("generate_image_txt",
"enabled",
"bool",
"create txt sidecars to display with images",
"the txt files created get shown when the lighttable is zoomed in to one image. also enable the txt overlay setting in the gui tab",
_("create txt sidecars to display with images"),
_("the txt files created get shown when the lighttable is zoomed in to one image. also enable the txt overlay setting in the gui tab"),
false)
dt.preferences.register("generate_image_txt",
"command",
"string",
"command to generate the txt sidecar",
"the output of this command gets written to the txt file. use $(FILE_NAME) for the image file",
_("command to generate the txt sidecar"),
_("the output of this command gets written to the txt file. use $(FILE_NAME) for the image file"),
"exiv2 $(FILE_NAME)")
local check_command = function(command)
if not command:find("$(FILE_NAME)", 1, true) then
dt.print("the command for txt sidecars looks bad. better check the preferences")
dt.print(_("the command for txt sidecars looks bad. better check the preferences"))
end
end

View File

@@ -32,20 +32,28 @@ USAGE
local dt = require "darktable"
local gettext = dt.gettext.gettext
gettext.bindtextdomain("import_filter_manager", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
local import_filter_list = {}
local n_import_filters = 1
-- allow changing the filter from the preferences
dt.preferences.register("import_filter_manager", "active_filter", "string",
"import filter", "the name of the filter used for importing images", "")
_("import filter"), _("the name of the filter used for importing images"), "")
-- the dropdown to select the active filter from the import dialog
local filter_dropdown = dt.new_widget("combobox")
{
label = "import filter",
label = _("import filter"),
editable = false,
tooltip = "import filters are applied after completion of the import dialog",
tooltip = _("import filters are applied after completion of the import dialog"),
changed_callback = function(widget)
dt.preferences.write("import_filter_manager", "active_filter", "string", widget.value)

View File

@@ -34,7 +34,7 @@ local dt = require "darktable"
-- ignore jpeg
dt.register_import_filter("ignore jpegs", function(event, images)
dt.print_error("ignoring all jpegs")
dt.print_log("ignoring all jpegs")
for i, img in ipairs(images) do
local extension = img:match("[^.]*$"):upper()
if (extension == "JPG") or (extension == "JPEG") then

View File

@@ -38,6 +38,14 @@ local du = require "lib/dtutils"
du.check_min_api_version("7.0.0", "save_selection")
local gettext = dt.gettext.gettext
gettext.bindtextdomain("save_selection", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
-- return data structure for script_manager
local script_data = {}
@@ -61,16 +69,16 @@ for i = 1, buffer_count do
local saved_selection
dt.register_event("save_selection save " .. i, "shortcut", function()
saved_selection = dt.gui.selection()
end, "save to buffer " .. i)
end, string.format(_("save to buffer %d"), i))
dt.register_event("save_selection restore " .. i, "shortcut", function()
dt.gui.selection(saved_selection)
end, "restore from buffer " .. i)
end, string.format(_("restore from buffer %d"), i))
end
local bounce_buffer = {}
dt.register_event("save_selection switch", "shortcut", function()
bounce_buffer = dt.gui.selection(bounce_buffer)
end, "switch selection with temporary buffer")
end, _("switch selection with temporary buffer"))
script_data.destroy = destroy

View File

@@ -38,6 +38,14 @@ local du = require "lib/dtutils"
du.check_min_api_version("7.0.0", "selection_to_pdf")
local gettext = dt.gettext.gettext
gettext.bindtextdomain("selection_to_pdf", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext(msg)
end
-- return data structure for script_manager
local script_data = {}
@@ -49,16 +57,16 @@ script_data.show = nil -- only required for libs since the destroy_method only h
dt.preferences.register
("selection_to_pdf","Open with","string",
"a pdf viewer",
"Can be an absolute pathname or the tool may be in the PATH",
_("a pdf viewer"),
_("can be an absolute pathname or the tool may be in the PATH"),
"xdg-open")
local title_widget = dt.new_widget("entry") {
placeholder="Title"
placeholder = _("title")
}
local no_of_thumbs_widget = dt.new_widget("slider")
{
label = "Thumbs per Line",
label = _("thumbs per line"),
soft_min = 1, -- The soft minimum value for the slider, the slider can't go beyond this point
soft_max = 10, -- The soft maximum value for the slider, the slider can't go beyond this point
hard_min = 1, -- The hard minimum value for the slider, the user can't manually enter a value beyond this point
@@ -66,10 +74,10 @@ local no_of_thumbs_widget = dt.new_widget("slider")
value = 4 -- The current value of the slider
}
local widget = dt.new_widget("box") {
orientation=horizontal,
dt.new_widget("label"){label = "Title:"},
orientation = horizontal,
dt.new_widget("label"){label = _("title:")},
title_widget,
dt.new_widget("label"){label = "Thumbnails per row:"},
dt.new_widget("label"){label = _("thumbnails per row:")},
no_of_thumbs_widget
}
@@ -116,7 +124,7 @@ local function destroy()
dt.print_log("done destroying")
end
dt.register_storage("export_pdf","Export thumbnails to pdf",
dt.register_storage(_("export_pdf"),_("export thumbnails to pdf"),
nil,
function(storage,image_table)
local my_title = title_widget.text
@@ -163,7 +171,7 @@ dt.register_storage("export_pdf","Export thumbnails to pdf",
local command = "pdflatex -halt-on-error -output-directory "..dir.." "..locfile
local result = dt.control.execute(command)
if result ~= 0 then
dt.print("Problem running pdflatex") -- this one is probably usefull to the user
dt.print(_("problem running pdflatex")) -- this one is probably usefull to the user
error("Problem running "..command)
end
@@ -173,7 +181,7 @@ dt.register_storage("export_pdf","Export thumbnails to pdf",
command = command.." "..pdffile
local result = dt.control.execute(command)
if result ~= 0 then
dt.print("Problem running pdf viewer") -- this one is probably usefull to the user
dt.print(_("problem running pdf viewer")) -- this one is probably usefull to the user
error("Problem running "..command)
end

View File

@@ -45,9 +45,7 @@ script_data.show = nil -- only required for libs since the destroy_method only h
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
local gettext = dt.gettext
gettext.bindtextdomain("executable_manager",dt.configuration.config_dir.."/lua/locale/")
local gettext = dt.gettext.gettext
local exec_man = {} -- our own namespace
exec_man.module_installed = false
@@ -57,8 +55,10 @@ exec_man.event_registered = false
-- F U N C T I O N S
-- - - - - - - - - - - - - - - - - - - - - - - - - - - -
gettext.bindtextdomain("executable_manager", dt.configuration.config_dir .."/lua/locale/")
local function _(msg)
return gettext.dgettext("executable_manager", msg)
return gettext(msg)
end
local function grep(file, pattern)
@@ -142,7 +142,7 @@ local matches = grep(DARKTABLERC, "executable_paths")
-- check if we have something to manage and exit if not
if #matches == 0 then
dt.print(_("No executable paths found, exiting..."))
dt.print(_("no executable paths found, exiting..."))
return
end
@@ -167,7 +167,7 @@ for i,exec in ipairs(exec_table) do
editable = false
}
executable_path_widgets[exec] = dt.new_widget("file_chooser_button"){
title = _("select ") .. exec .. _(" executable"),
title = _(string.format("select %s executable", exec)),
value = df.get_executable_path_preference(exec),
is_directory = false,
changed_callback = function(self)
@@ -210,7 +210,7 @@ for i,exec in ipairs(exec_table) do
dt.new_widget("section_label"){label = _("reset")},
dt.new_widget("button"){
label = _("clear"),
tooltip = _("Clear path for ") .. exec,
tooltip = string.format(_("clear path for %s"), exec),
clicked_callback = function()
df.set_executable_path_preference(exec, "")
executable_path_widgets[exec].value = ""

View File

@@ -1,108 +0,0 @@
--[[
gen_18n_mo.lua - generate .mo files from .po files and put them in the correct place
Copyright (C) 2016,2018 Bill Ferguson <wpferguson@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
--[[
gen_i18n_mo - generate translation files from the source and place them in the appropriate locale directory
gen_i18n_mo finds all the .po files scattered throughout the script tree, compiles them into
.mo files and places them in the correct locale directory for use by the gettext tools.
]]
local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local log = require "lib/dtutils.log"
local dtsys = require "lib/dtutils.system"
du.check_min_api_version("5.0.0", "gen_I18n_mo")
local function destroy()
-- nothing to destroy
end
-- figure out the path separator
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
local LUA_DIR = dt.configuration.config_dir .. PS .. "lua" .. PS
local LOCALE_DIR = dt.configuration.config_dir .. PS .. "lua" .. PS .. "locale" .. PS
-- check if we have msgfmt
local msgfmt_executable = df.check_if_bin_exists("msgfmt")
if msgfmt_executable then
-- find the .po files
local find_cmd = "find -L " .. LUA_DIR .. " -name \\*.po -print"
if dt.configuration.running_os == "windows" then
find_cmd = "dir /b/s " .. LUA_DIR .. "\\*.po"
end
local output = io.popen(find_cmd)
-- for each .po file....
for line in output:lines() do
local fname = df.get_filename(line)
-- get the language used... this depends on the file being named using
-- the convention /..../lang/LC_MESSAGES/file.po where lang is de_DE, fr_FR, etc.
local path_parts = du.split(line, PS)
local lang = path_parts[#path_parts - 2]
-- ensure there is a destination directory for them
local mkdir_cmd = "mkdir -p "
if dt.configuration.running_os == "windows" then
mkdir_cmd = "mkdir "
end
if not df.check_if_file_exists(LOCALE_DIR .. lang .. PS .. "LC_MESSAGES") then
log.msg(log.info, "Creating locale", lang)
os.execute(mkdir_cmd .. LOCALE_DIR .. lang .. PS .. "LC_MESSAGES")
end
-- generate the mo file
fname = string.gsub(fname, ".po$", ".mo")
log.msg(log.info, "Compiling translation to", fname)
local result = os.execute(msgfmt_executable .. " -o " .. LOCALE_DIR .. lang .. PS .. "LC_MESSAGES" .. PS .. fname .. " " .. line)
end
else
log.msg(log.screen, "ERROR: msgfmt executable not found. Please install or specifiy location in preferences.")
end
dt.preferences.register("executable_paths", "msgfmt", -- name
"file", -- type
'gen_i18n_mo: msgfmt location', -- label
'Install location of msgfmt. Requires restart to take effect.', -- tooltip
"msgfmt", -- default
dt.new_widget("file_chooser_button"){
title = "Select msgfmt[.exe] file",
value = "",
is_directory = false,
}
)
local script_data = {}
script_data.destroy = destroy
return script_data

View File

@@ -56,14 +56,14 @@ local dtsys = require "lib/dtutils.system"
local log = require "lib/dtutils.log"
local debug = require "darktable.debug"
local gettext = dt.gettext
-- set up translation
local gettext = dt.gettext.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("script_manager",dt.configuration.config_dir.."/lua/locale/")
gettext.bindtextdomain("script_manager", dt.configuration.config_dir .."/lua/locale/")
local function _(msgid)
return gettext.dgettext("script_manager", msgid)
return gettext(msgid)
end
-- api check
@@ -369,7 +369,7 @@ local function get_script_doc(script)
-- assume that the second block comment is the documentation
description = string.match(content, "%-%-%[%[.-%]%].-%-%-%[%[(.-)%]%]")
else
log.msg(log.error, _("Cant read from " .. script))
log.msg(log.error, "Cant read from " .. script)
end
if description then
restore_log_level(old_log_level)
@@ -392,7 +392,7 @@ local function activate(script)
script_manager_running_script = nil
if status then
pref_write(script.script_name, "bool", true)
log.msg(log.screen, _("Loaded ") .. script.script_name)
log.msg(log.screen, string.format(_("loaded %s"), script.script_name))
script.running = true
if err ~= true then
log.msg(log.debug, "got lib data")
@@ -404,7 +404,7 @@ local function activate(script)
script.data = nil
end
else
log.msg(log.screen, script.script_name .. _(" failed to load"))
log.msg(log.screen, string.format(_("%s failed to load"), script.script_name))
log.msg(log.error, "Error loading " .. script.script_name)
log.msg(log.error, "Error message: " .. err)
end
@@ -443,11 +443,11 @@ local function deactivate(script)
script.running = false
end
log.msg(log.info, "turned off " .. script.script_name)
log.msg(log.screen, script.name .. _(" stopped"))
log.msg(log.screen, string.format(_("%s stopped"), script.name))
else
script.running = false
log.msg(log.info, "setting " .. script.script_name .. " to not start")
log.msg(log.screen, script.name .. _(" will not start when darktable is restarted"))
log.msg(log.screen, string.format(_("%s will not start when darktable is restarted"), script.name))
end
restore_log_level(old_log_level)
end
@@ -545,7 +545,7 @@ local function scan_scripts(script_dir)
if dt.configuration.running_os == "windows" then
find_cmd = "dir /b/s \"" .. script_dir .. "\\*.lua\" | sort"
end
log.msg(log.debug, _("find command is ") .. find_cmd)
log.msg(log.debug, "find command is " .. find_cmd)
-- scan the scripts
local output = io.popen(find_cmd)
for line in output:lines() do
@@ -575,7 +575,7 @@ local function update_scripts()
local git = sm.executables.git
if not git then
dt.print(_("ERROR: git not found. Install or specify the location of the git executable."))
dt.print(_("ERROR: git not found, install or specify the location of the git executable."))
return
end
@@ -621,7 +621,7 @@ local function scan_repositories()
if dt.configuration.running_os == "windows" then
find_cmd = "dir /b/s /a:d " .. LUA_DIR .. PS .. "*.git | sort"
end
log.msg(log.debug, _("find command is ") .. find_cmd)
log.msg(log.debug, "find command is " .. find_cmd)
local output = io.popen(find_cmd)
for line in output:lines() do
local l = string.gsub(line, ds.sanitize_lua(LUA_DIR) .. PS, "") -- strip the lua dir off
@@ -659,7 +659,7 @@ local function install_scripts()
local category = sm.widgets.new_category.text
if string.match(du.join(sm.categories, " "), ds.sanitize_lua(category)) then
log.msg(log.screen, _("category ") .. category .. _(" is already in use. Please specify a different category name."))
log.msg(log.screen, string.format(_("category %s is already in use, please specify a different category name."), category))
log.msg(log.error, "category " .. category .. " already exists, returning...")
restore_log_level(old_log_level)
return
@@ -670,7 +670,7 @@ local function install_scripts()
local git = sm.executables.git
if not git then
dt.print(_("ERROR: git not found. Install or specify the location of the git executable."))
dt.print(_("ERROR: git not found, install or specify the location of the git executable."))
restore_log_level(old_log_level)
return
end
@@ -690,7 +690,7 @@ local function install_scripts()
local count = scan_scripts(LUA_DIR .. PS .. category)
if count > 0 then
update_combobox_choices(sm.widgets.category_selector, sm.categories, sm.widgets.category_selector.selected)
dt.print(_("scripts successfully installed into category ") .. category)
dt.print(string.format(_("scripts successfully installed into category "), category))
table.insert(sm.installed_repositories, {name = category, directory = LUA_DIR .. PS .. category})
update_script_update_choices()
for i = 1, #sm.widgets.category_selector do
@@ -706,7 +706,7 @@ local function install_scripts()
sm.widgets.new_category.text = ""
sm.widgets.main_menu.selected = 3
else
dt.print(_("No scripts found to install"))
dt.print(_("no scripts found to install"))
log.msg(log.error, "scan_scripts returned " .. count .. " scripts found. Not adding to category_selector")
end
else
@@ -751,14 +751,14 @@ local function populate_buttons(category, first, last)
button.label = script.name
button.name = "sm_started"
else
button.label = script.name .. _(" started")
button.label = string.format(_("%s started"), script.name)
end
else
if sm.use_color then
button.label = script.name
button.name = "sm_stopped"
else
button.label = script.name .. _(" stopped")
button.label = string.format(_("%s stopped"), script.name)
end
end
button.ellipsize = "middle"
@@ -781,7 +781,7 @@ local function populate_buttons(category, first, last)
if sm.use_color then
this.name = "sm_stopped"
else
this.label = script.name .. _(" stopped")
this.label = string.format(_("%s stopped"), script.name)
end
else
log.msg(log.debug, "activating " .. script.name .. " on " .. script.path .. " for button " .. this.label)
@@ -790,7 +790,7 @@ local function populate_buttons(category, first, last)
if sm.use_color then
this.name = "sm_started"
else
this.label = script.name .. " started"
this.label = string.format(_("%s started"), script.name)
end
end
end
@@ -858,7 +858,7 @@ local function paginate(direction)
else
last = first + sm.page_status.num_buttons - 1
end
sm.widgets.page_status.label = _("Page ") .. cur_page .. _(" of ") .. max_pages
sm.widgets.page_status.label = string.format(_("page %d of %d"), cur_page, max_pages)
populate_buttons(category, first, last)
restore_log_level(old_log_level)
@@ -1121,7 +1121,7 @@ sm.widgets.add_scripts = dt.new_widget("box"){
}
sm.widgets.allow_disable = dt.new_widget("check_button"){
label = _('Enable "Disable Scripts" button'),
label = _('enable "disable scripts" button'),
value = false,
clicked_callback = function(this)
if this.value == true then
@@ -1131,7 +1131,7 @@ sm.widgets.allow_disable = dt.new_widget("check_button"){
}
sm.widgets.disable_scripts = dt.new_widget("button"){
label = _("Disable Scripts"),
label = _("disable scripts"),
sensitive = false,
clicked_callback = function(this)
local LUARC = dt.configuration.config_dir .. PS .. "luarc"
@@ -1157,7 +1157,7 @@ sm.widgets.install_update = dt.new_widget("box"){
sm.widgets.category_selector = dt.new_widget("combobox"){
label = _("category"),
tooltip = _( "select the script category"),
tooltip = _("select the script category"),
selected = 1,
changed_callback = function(self)
if sm.run then
@@ -1177,7 +1177,7 @@ end
local page_back = "<"
local page_forward = ">"
sm.widgets.page_status = dt.new_widget("label"){label = _("Page:")}
sm.widgets.page_status = dt.new_widget("label"){label = _("page:")}
sm.widgets.page_back = dt.new_widget("button"){
label = page_back,
clicked_callback = function(this)
@@ -1205,7 +1205,7 @@ sm.widgets.page_control = dt.new_widget("box"){
sm.widgets.scripts = dt.new_widget("box"){
orientation = vertical,
dt.new_widget("label"){label = _("Scripts")},
dt.new_widget("label"){label = _("scripts")},
sm.widgets.category_selector,
sm.widgets.page_control,
table.unpack(sm.widgets.buttons)
@@ -1234,7 +1234,7 @@ sm.widgets.change_buttons = dt.new_widget("button"){
sm.widgets.configure = dt.new_widget("box"){
orientation = "vertical",
dt.new_widget("label"){label = _("Configuration")},
dt.new_widget("label"){label = _("configuration")},
sm.widgets.num_buttons,
sm.widgets.change_buttons,
}