Module:Languages/cache

From The Languages of David J. Peterson
Revision as of 02:35, 4 March 2020 by Djp (talk | contribs) (Created page with "local getByCode = require("Module:languages").getByCode local langs = {} -- Auto-create language objects: langs.en -> language object for English. setmetatable(langs, { __i...")
(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/documentation

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