Module:Languages/cache

From Wikispooks
Jump to navigation Jump to search

Documentation for this module may be created at Module:Languages/cache/doc

local getByCode = require("Module:languages").getByCode

local langs = {}

-- Auto-create language objects: langs.en -> language object for English.
setmetatable(langs, {
	__index = function(self, key)
		local lang = getByCode(key) or false
		self[key] = lang
		return lang
	end
})

return langs