Module:languages: Difference between revisions
No edit summary |
No edit summary |
||
| Line 110: | Line 110: | ||
local export = {} | local export = {} | ||
local families_module = "Module:families" | local families_module = "Module:families" | ||
local json_module = "Module:JSON" | local json_module = "Module:JSON" | ||
| Line 158: | Line 157: | ||
check_object = require(utilities_module).check_object | check_object = require(utilities_module).check_object | ||
return check_object(...) | return check_object(...) | ||
end | end | ||
| Line 294: | Line 288: | ||
return uupper(...) | return uupper(...) | ||
end | end | ||
local function normalize_code(code) | local function normalize_code(code) | ||
| Line 1,469: | Line 1,458: | ||
if (not text) or text == "" then | if (not text) or text == "" then | ||
return text, nil, {} | return text, nil, {} | ||
end | end | ||
-- Remove directional characters, soft hyphens, strip markers and HTML tags. | -- Remove directional characters, soft hyphens, strip markers and HTML tags. | ||
| Line 1,602: | Line 1,588: | ||
if not (sc:isTransliterated() or module_override) then | if not (sc:isTransliterated() or module_override) then | ||
-- temporary tracking to see if/when this gets triggered | -- temporary tracking to see if/when this gets triggered | ||
return nil, true, {} | return nil, true, {} | ||
end | end | ||
| Line 1,642: | Line 1,624: | ||
return m1 .. uupper(m2) | return m1 .. uupper(m2) | ||
end) | end) | ||
end | end | ||
| Line 1,954: | Line 1,931: | ||
function export.getByCode(code, paramForError, allowEtymLang, allowFamily) | function export.getByCode(code, paramForError, allowEtymLang, allowFamily) | ||
-- Track uses of paramForError, ultimately so it can be removed, as error-handling should be done by [[Module:parameters]], not here. | -- Track uses of paramForError, ultimately so it can be removed, as error-handling should be done by [[Module:parameters]], not here. | ||
if type(code) ~= "string" then | if type(code) ~= "string" then | ||
local typ | local typ | ||
| Line 1,972: | Line 1,947: | ||
local m_data = load_data("Module:languages/data") | local m_data = load_data("Module:languages/data") | ||
local norm_code = normalize_code(code) | local norm_code = normalize_code(code) | ||