Merge pull request #86 from MCMic/unstable

Fixed support for incomplete translations
This commit is contained in:
Laurent Peuch 2017-08-17 23:13:34 +02:00 committed by GitHub
commit 37938fd0f4

View file

@ -50,8 +50,8 @@ end
-- Find a string by its translate key in the right language -- Find a string by its translate key in the right language
function t(key) function t(key)
if conf.lang and i18n[conf.lang] then if conf.lang and i18n[conf.lang] and i18n[conf.lang][key] then
return i18n[conf.lang][key] or "" return i18n[conf.lang][key]
else else
return i18n[conf["default_language"]][key] or "" return i18n[conf["default_language"]][key] or ""
end end
@ -556,13 +556,8 @@ function get_data_for(view)
end end
-- Pass all the translated strings to the view (to use with t_<key>) -- Pass all the translated strings to the view (to use with t_<key>)
if conf.lang and i18n[conf.lang] then for k, v in pairs(i18n[conf["default_language"]]) do
translate_table = i18n[conf.lang] data["t_"..k] = i18n[conf.lang][k] or v
else
translate_table = i18n[conf["default_language"]]
end
for k, v in pairs(translate_table) do
data["t_"..k] = v
end end
-- Pass flash notification content -- Pass flash notification content