Module:Lang: Difference between revisions

Jump to navigation Jump to search
Undo revision 5442 by Saag (talk)
Tag: Undo
Added improved error handling for search_string
Line 57: Line 57:
end
end


-- If the key is found, return the localized string, otherwise return a fallback
if (key == nil) then
if key and data_lang[key] then
return string.format("English label '%s' not found", label)
return data_lang[key]
else
return "English label not found or not localized"
end
end
if (data_lang[key] == nil) then
return string.format("Key '%s' not found in for lang code '%s'", key, lang_code)
end
return data_lang[key]
end
end