Module:languages/by name

Ut Wikiwurdboek
Springe nei navigaasje Springe nei sykjen
local export = {}

local function iterate(list)
	for code, data in pairs(list) do
		export[data[1]] = code
		
		if data.otherNames then
			for i, otherName in pairs(data.otherNames) do
				if not export[otherName] then
					export[otherName] = code
				end
			end
		end
	end
end

iterate(mw.loadData("Module:languages/data2"))

for letter in mw.ustring.gmatch("abcdefghijklmnopqrstuvwxyz", "(.)") do
	iterate(mw.loadData("Module:languages/data3/" .. letter))
end

iterate(mw.loadData("Module:languages/datax"))

return export