Module:Languages/cache

From Wikispooks
< Module:Languages
Revision as of 19:27, 1 February 2019 by Robin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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