Module:word list

local m_lang = require("Module:languages")

local export = {}

-- a light version of require("Module:links").language_link local function link(lang_name,text) return ""..text.."" end

function export.show(frame) local data = mw.loadData("Module:word list/data/"..frame.args[1]) local res = '{| class="wikitable sortable"\n! No.\n' local langs = {} local lang_names = {} for j,lang in ipairs(data.lang) do		langs[j] = m_lang.getByCode(lang) lang_names[j] = langs[j]:getCanonicalName res = res .. '! ' .. langs[j]:makeCategoryLink .. '\n' end for i,words in ipairs(data) do res = res .. '|-\n' res = res .. '| ' .. i .. '\n' for j,word in ipairs(words) do			if not langs[j] then error("Length mismatch for "..words[1]) end if type(word) == "string" then word = (word == "") and {} or {word} end local links = {} for k,syn in ipairs(word) do				links[k] = link(lang_names[j],syn) end res = res .. '| ' .. table.concat(links,'; ') .. '\n' end end res = res .. '|}'	return res end

return export