Jump to content

Module:yue-IPA

From Wiktionary, the free dictionary


export = {}

function export.yueIPA(frame)
	local params = {
		[1] = {},
		[2] = {}, --this param is ignored
		['audio'] = {},
		['a'] = { alias_of = 'audio' },
		['loc'] = {},
		['cx'] = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local yue_pron = require("Module:yue-pron")
	local m_a = require("Module:accent qualifier")
	local m_IPA = require("Module:IPA")
	local lang = require("Module:languages").getByCode("yue")

	if args[2] then require("Module:debug").track("yue-IPA/multiple-args") end
	
	local rom = args[1]
	local audio = args.audio or ''
	local loc = args.loc or '[[w:Guangzhou Cantonese|Guangzhou]]'
	local cx = args.cx or ''
	if audio ~= '' then
		audio = audio=='y' and 'yue-'..rom..'.ogg' or audio
		audio = [=[
** {{audio|lang=yue|]=]..audio..'}}'
	end

	return '* '..m_a.format_qualifiers(lang, {"[[w:Standard Cantonese|Standard Cantonese]]", loc, cx})..[=[ 
** ''[[w:Jyutping|Jyutping]]'': <span style="font-family:monospace">]=]..rom..[=[</span>
** ''[[w:Yale romanization of Cantonese|Yale]]'': <span style="font-family:monospace">]=]..yue_pron.jyutping_to_yale(rom)..[=[</span>
** ]=]..m_IPA.format_IPA_full { lang = lang, items = {{pron="/"..yue_pron.jyutping_to_ipa(rom).."/"}} }
..audio
end

return export