Module:jje-translit

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

This module will transliterate Jeju 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:jje-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.

-- Created from Module:ko.translit
local export = {}

local m_str_utils = require("Module:string utilities")

local gsub = m_str_utils.gsub
local match = m_str_utils.match

function export.tr(text, lang, sc)
	if (not text) or text == "" then
		return text
	end
	local HaniChars = require("Module:scripts").getByCode("Hani"):getCharacters()
	text = gsub(text, "%<%/?r%>", "")
	text = gsub(text, "%<%/?ruby%>", "")
	-- remove hanja from (ex.) 사전(辭典) and 辭典(사전)
	text = gsub(text, "%(+%)", "")
	text = gsub(text, "%(*'''+'''*%)", "")
	text = gsub(text, "+%((.-)%)", "%1")

	-- transform em-dash to plain hyphen-minus
	text = gsub(text, "—", "-")
	
	if match(text, "^+$") then
		return (gsub(text,
			"", {
				 = "g",  = "kk",  = "ks",  = "n",  = "nj",  = "nh",  = "d",  = "tt",  = "l",  = "lg",
				 = "lm",  = "lb",  = "ls",  = "lt",  = "lp",  = "lh",  = "m",  = "ms",  = "b",  = "pp",  = "ps",
				 = "s",  = "ss",  = "'",  = "j",  = "jj",  = "ch",  = "k",  = "t",  = "p",  = "h",
				 = "a",  = "ae",  = "ya",  = "yae",  = "eo",  = "e",  = "yeo",
				 = "ye",  = "o",  = "wa",  = "wya",  = "wae",  = "oe",  = "yo",  = "u",
				 = "wo",  = "we",  = "wi",  = "yu",  = "eu",  = "ui",  = "i", 
				 = "aw",  = "yaw" }
		))
	end

	-- transform compat jamo into a form ] can handle
	-- for ] ] etc.
	-- could be moved to ]
	if match(text, "%-") then
		text = gsub(text,
			"", {
				 = "ᆨ",  = "ᆩ",  = "ᆪ",  = "ᆫ",  = "ᆬ",  = "ᆭ",  = "ᆮ",  = "ᆯ",  = "ᆰ",
				 = "ᆱ",  = "ᆲ",  = "ᆳ",  = "ᆴ",  = "ᆵ",  = "ᆶ",  = "ᆷ",  = "ᇝ",  = "ᆸ",  = "ᆹ",
				 = "ᆺ",  = "ᆻ",  = "ᆼ",  = "ᆽ",  = "ᆾ",  = "ᆿ",  = "ᇀ",  = "ᇁ",  = "ᇂ", }
		)
	end
	
	local HangChars = require("Module:scripts").getByCode("Hang"):getCharacters()
	local m_pron = require("Module:jje-pron")
	
	text = gsub(text, "+", function(m1) return m_pron.romanise(m1, 2, {}, true) end)

	return text and text
		:gsub("()%-%'()", "%1-%2")
		:gsub("%-'''%-", "'''-")
		:gsub("%-%-", "-")
end

export.tr_revised = export.tr

return export