This module will transliterate ၽႃႇသႃႇKorean text.

The module should preferably not be called directly from templates or other modules. To use it from a template, use Lua error in မေႃႇၵျူး:parameters at line 600: attempt to index local 'param' (a boolean value).. Within a module, use Module:languages#Language:transliterate.

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

လၢႆးႁဵတ်းၵၢၼ်

မႄးထတ်း
Lua error in မေႃႇၵျူး:parameters at line 600: attempt to index local 'param' (a boolean value).
Transliterates a given piece of Lua error in မေႃႇၵျူး:parameters at line 600: attempt to index local 'param' (a boolean value). written in the script specified by the code Lua error in မေႃႇၵျူး:parameters at line 600: attempt to index local 'param' (a boolean value)., and language specified by the code Lua error in မေႃႇၵျူး:parameters at line 600: attempt to index local 'param' (a boolean value).. When the transliteration fails, returns Lua error in မေႃႇၵျူး:parameters at line 600: attempt to index local 'param' (a boolean value)..

Lua error in မေႃႇၵျူး:module_categorization at line 173: This template should only be used in the Module namespace, not on page 'မေႃႇၵျူး:ko-translit'..


local export = {}

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

local gsub = m_str_utils.gsub

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[pt]%>", "")
	text = gsub(text, "%<%/?ruby%>", "")
	-- remove hanja from (ex.) 사전(辭典) and 辭典(사전) and 온돌(溫突/溫堗)
	text = gsub(text, "%([" .. HaniChars .. "/]+%)", "")
	text = gsub(text, "%([" .. HaniChars .. "]*'''[" .. HaniChars .. "]+'''[" .. HaniChars .. "]*%)", "")
	text = gsub(text, "[" .. HaniChars .. "]+%((.-)%)", "%1")
	
	-- transform em-dash to plain hyphen-minus
	text = gsub(text, "—", "-")
	
	local HangChars = require("Module:scripts").getByCode("Hang"):getCharacters()
	local m_pron = require("Module:ko-pron")
	
	text = gsub(text, "[" .. HangChars .. "%s%p􀀀-􏿽]+", function(m1) return m_pron.romanise(m1, 2, {}, true) end)
	
	return text and text
		:gsub("(%a)%-%'(%a)", "%1-%2")
		:gsub("%-'''%-", "'''-")
		:gsub("%-%-", "-")
end

export.tr_revised = export.tr

return export