Jump to content

Module:writing systems

Wiktionary වෙතින්


local export = {}

local System = {}

local m_sinhala = require("Module:sinhala")


function System:getCode()
	return self._code
end


function System:getCanonicalName()
	return self._rawData.canonicalName
end


function System:getOtherNames()
	return self._rawData.otherNames or {}
end


--function System:getAllNames()
--	return self._rawData.names
--end


function System:getType()
	return "Writing system"
end


function System:getCategoryName()
	return self._rawData.category or mw.getContentLanguage():ucfirst(m_sinhala.sinhala_plural(self:getCanonicalName()))
end

function System:getRawData()
	return self._rawData
end


function System:toJSON()
	local ret = {
		canonicalName = self:getCanonicalName(),
		categoryName = self:getCategoryName(),
		code = self._code,
		otherNames = self:getOtherNames(),
		type = self:getType(),
	}
	
	return require("Module:JSON").toJSON(ret)
end


System.__index = System


function export.makeObject(code, data)
	return data and setmetatable({ _rawData = data, _code = code }, System) or nil
end


function export.getByCode(code)
	return export.makeObject(code, mw.loadData("Module:writing systems/data")[code])
end

return export
"https://si.wiktionary.org/w/index.php?title=Module:writing_systems&oldid=33349" වෙතින් සම්ප්‍රවේශනය කෙරිණි