Module:Lang: Difference between revisions

Sur (talk | contribs)
m bugfix with 'dictionary' fallback option
m Default search string to input label if none is found
Line 101: Line 101:


if (data_lang == nil) then
if (data_lang == nil) then
return string.format("Lang code '%s' does not have a json file", lang_code)
error("Lang code '%s' does not have a json file", lang_code)
end
end
Line 113: Line 113:
end
end


-- Default to input label if localized string is not found
if (key == nil) then
if (key == nil) then
return string.format("English label '%s' not found", label)
return label
end
end
if (data_lang[key] == nil) then
if (data_lang[key] == nil) then
return label
return label