Module:urk-translit

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

This module will transliterate Urak Lawoi' language text. The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}. Within a module, use Module:languages#Language:transliterate.

For testcases, see Module:urk-translit/testcases.

Functions

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

local export = {}

local urk = require("Module:urk-common")
local match = mw.ustring.match

local initials = {
	 = "k",
	 = "g",
	 = "kh",
	 = "ng",
	 = "c",
	 = "ch",
	 = "s",
	 = "ch",  -- nonstandard spellling
	 = "ny",
	 = "d",
	 = "t",
	 = "th",
	 = "n",
	 = "b",
	 = "p",
	 = "ph",
	 = "f",
	 = "m",
	 = "y",
	 = "j",
	 = "r",
	 = "l",
	 = "w",
	 = "ʼ",
	 = "h"
}

local medials = {
	 = "r",
	 = "l"
}

local vowels = {
	 = "ö",
	 = "ë",
	 = "aw",
	 = "e",
	 = "e",
	 = "ia",
	 = "ä",
	 = "o",
	 = "a",
	 = "ua",
	 = "a",
	 = "i",
	 = "i",
	 = "e", -- nonstandard spelling
	 = "e",
	 = "u",
	 = "u"
}

local finals = {
	 = "k",
	 = "ng",
	 = "c", -- alterative spelling
	 = "t",
	 = "n",
	 = "p",
	 = "m",
	 = "y",
	 = "c",
	 = "s",
	 = "l", -- variable pronunciation
	 = "l", -- only in phuket
	 = "w",
	 = "h",
	 = "q",
	 = "h" -- alterative spelling
}

-- main function
function export.tr(text, lang, sc)
	local translit = ""
	local respelt = urk.syllabise(text, true)

	for _, segment in ipairs(respelt) do
		if match(segment, "") then
			local v_pref, i, m, v_suf, f_pref, f_suf = match(segment, urk.syllable_pattern)

			local v = v_pref .. v_suf
			-- special case for "เีย"
			if v_pref == "เ" and v_suf == "ี" and f_pref == "ย" then
				v = "เีย"
				f_pref = ""
			end
			local f = f_pref .. f_suf

			-- join components together
			translit = translit .. (initials or "") .. (medials or "") .. (vowels or "") .. (finals or "")
		else
			translit = translit .. segment
		end
	end

	return translit
end

return export