Module:IPA letters

Hello, you have come here looking for the meaning of the word Module:IPA letters. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:IPA letters, but we will also tell you about its etymology, its characteristics and you will know how to say Module:IPA letters in singular and plural. Everything you need to know about the word Module:IPA letters you have here. The definition of the word Module:IPA letters will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:IPA letters, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

A module to generate the content of {{IPA letters}}.


local export = {}

function export.get_IPA_pronunciation(lang, items)
	local ok, pronunciation_data = pcall(require, "Module:IPA letters/" .. lang:getCode())
	if not ok then
		error("There isn't a data module for " .. lang:getCanonicalName()
			.. ". Please create ].")
	end
	
	local output = require("Module:array")()
	for i, item in ipairs(items) do
		local stress, letter_or_number = item:match("^('?)(.+)$")
		if i > 1 then
			output:insert " "
		end
		if stress == "'" then
			output:insert "ˈ"
		end
		
		letter_or_number = mw.ustring.upper(letter_or_number)
		
		output:insert(pronunciation_data or "{{{" .. i .. "}}}")
	end
	
	return output:concat()
end

function export.show_IPA_pronunciation(lang, items)
	return require("Module:IPA").format_IPA_full {
		lang = lang,
		items = {{pron = "/" .. export.get_IPA_pronunciation(lang, items) .. "/"}},
	}
end

function export.show(frame)
	local args = frame:getParent().args
	local title = mw.title.getCurrentTitle()
	
	if title.nsText == "Template" and not (args.lang and args) then
		args = { lang = "en", "a", "b", "c" }
	end
	
	lang = args.lang or error("The parameter 'lang' is required.")
	local m_languages = require("Module:languages")
	lang = lang and m_languages.getByCode(lang)
		or m_languages.err(lang, "lang")
	
	if not (args and args ~= "") then
		error("Parameter 1 is required.")
	end
	
	return export.show_IPA_pronunciation(lang, args)
end

return export