模組:CWLA

维基百科,自由的百科全书
文档图示 模块文档[创建]
-- For Chinese Wikipedia Library and Archives
local p = {}

local function _loadData(name)
    local data = nil
    local state
    state, data = pcall(mw.loadData, 'Module:CWLA/' .. name)
    return data
end
 
function p.codeName(frame)
    local a = frame.args
    local d = _loadData('codeDict')
    
    if d.code[a.code] ~= nil then
        if (a.origin == '1') then
            return d.code[a.code].title
        elseif (a.origin == '0' and a.lan == 'hans') then
            return d.code[a.code].s_title
        elseif (a.origin == '0' and a.lan == 'hant') then
            return d.code[a.code].t_title
        end
    end
    
end
 
return p