Module:POTY/font

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Lua
CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules

Documentation for this module may be created at Module:POTY/font/doc

Code

require('strict')

local p = {}

local getArgs = require('Module:Arguments').getArgs

function p.checkIfFontSupportsLanguage(font, lang)
	if not lang then
		lang = mw.getCurrentFrame():callParserFunction('int', 'lang')
	end
	lang = mw.text.split(lang, '-', true)[1]
	
	local fs = require('Module:POTY/font/' .. font .. '/support')
	
	for i, f in ipairs(fs) do
		if f == lang then
			return true
		end
	end
	return false
end

function p._doesFontSupportLanguage(args)
	return (p.checkIfFontSupportsLanguage(args['font'], args['lang']) and args['supported']) or args['notsupported']
end

function p.doesFontSupportLanguage(frame)
	return p._doesFontSupportLanguage(getArgs(frame))
end

return p