Module:languages: Difference between revisions

No edit summary
No edit summary
Line 110: Line 110:
local export = {}
local export = {}


local debug_track_module = "Module:debug/track"
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
local function debug_track(...)
debug_track = require(debug_track_module)
return debug_track(...)
end
end


Line 294: Line 288:
return uupper(...)
return uupper(...)
end
end
local function track(page)
debug_track("languages/" .. page)
return true
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
if match(text, "<[^<>]+>") then
track("track HTML tag")
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
track("non-transliterable")
track("non-transliterable/" .. self:getCode())
track("non-transliterable/" .. sc:getCode())
track("non-transliterable/" .. sc:getCode() .. "/" .. self:getCode())
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
-- Track module overrides.
if module_override ~= nil then
track("module_override")
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 paramForError ~= nil then
 
track("paramForError")
end
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")
if m_data.aliases[code] or m_data.track[code] then
track(code)
end


local norm_code = normalize_code(code)
local norm_code = normalize_code(code)