Update gettextExample.lua

function _(msgid)
This commit is contained in:
supertobi
2016-01-29 23:01:05 +01:00
parent 72a97ecbd6
commit 077a7de605

View File

@@ -63,5 +63,14 @@ local gettext = dt.gettext
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/")
-- Translate a string using the specified textdomain
dt.print_error(gettext.dgettext("gettextExample", 'Hello World!'))
-- 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)
end
dt.print_error(_('Hello World!'))