Module:Lang: Difference between revisionsGive feedback
Added improved error handling for search_string |
Added _get_string for use internally |
||
| Line 29: | Line 29: | ||
if (label == nil) then | if (label == nil) then | ||
return string.format("Key '%s' not found", key) | return string.format("Key '%s' not found", key) | ||
end | |||
return label | |||
end | |||
-- get_string, but for internal use by other modules | |||
p._get_string = function(key) | |||
lang_code = get_lang_code() | |||
local data = get_lang_file(lang_code) | |||
if (data == nil) then | |||
return nil | |||
end | |||
local label = data[key] | |||
if (label == nil) then | |||
return nil | |||
end | end | ||