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


local export = {}

local function fake_frame(args, parent_args)
	return {
		args = args,
		getParent = function()
			return {
				args = parent_args,
			}
		end
	}
end

function get_by_code(code)
	return require("Module:languages").getByCode(code, nil, true, true) or require("Module:scripts").getByCode(code)
end

local function get_code_from_title_without_namespace(title_without_namespace)
	local prefix = title_without_namespace:match("^(.+)%-translit%f")
	if not prefix then
		error("Base segment of title should end in -translit: " .. title_without_namespace)
	end
	local code = prefix
	local lang_or_family_or_script = get_by_code(code)
	if not lang_or_family_or_script then
		-- Accommodate modules with multiple codes in the title.
		-- The first code should be used.
		-- Right now it strips segments from the end until it finds a match:
		-- Module:Deva-Beng-translit -> Deva-Beng -> Deva
		-- Module:pra-Deva-translit -> pra-Deva -> pra
		-- Module:Deva-mnc-Mong-translit -> Deva-mnc-Mong -> Deva-mnc -> Deva
		while true do
			new_code = code:match("^(.+)%-+$")
			if new_code then
				code = new_code
			else
				break
			end
			lang_or_family_or_script = get_by_code(new_code)
			if lang_or_family_or_script then
				break
			end
		end
	end
	
	return code, lang_or_family_or_script
end

function export.documentation(title_without_namespace, explanation)
	local code, lang_or_family_or_script = get_code_from_title_without_namespace(title_without_namespace)
	return export.documentation_from_code(code, explanation, title_without_namespace)
end

function export.documentation_from_code(code, explanation, title_without_namespace)
	local lang_or_family_or_script = get_by_code(code)
	
	if not lang_or_family_or_script then
		return "Language code in page name (<code>" .. code .. "</code>) not recognized."
	end
	
	local category_name = lang_or_family_or_script:getCategoryName()
	
	local transliteration_input
	if lang_or_family_or_script:hasType("script") then
		transliteration_input = "text in the ]"
	elseif lang_or_family_or_script:hasType("family") then
		transliteration_input = "text in one of the ]"
	else -- language
		transliteration_input = "] text"
	end
	
	local tr_page = "WT:" .. mw.ustring.upper(code) .. " TR"
	
	return "This module will transliterate " .. transliteration_input
		.. (explanation and " " .. explanation or "")
		.. (mw.title.new(tr_page).exists and " per ]" or "")
		.. ". "
		.. require("Module:documentation").translitModuleLangList({args = {  = title_without_namespace:gsub("/documentation$", "") }})
		.. [=[

The module should preferably not be called directly from templates or other modules.
To use it from a template, use <code>{{]}}</code>.
Within a module, use ].

For testcases, see =] .. title_without_namespace:gsub("/documentation$", "") .. ].

== Functions ==
; <code>tr(text, lang, sc)</code>
: Transliterates a given piece of <code>text</code> written in the script specified by the code <code>sc</code>, and language specified by the code <code>lang</code>.
: When the transliteration fails, returns <code>nil</code>.]=]
		.. require("Module:module categorization").categorize(fake_frame({
				is_template = "1",
				 = title_without_namespace,
			}, {
				 = code,
			}))
end

function export.documentation_template(frame)
	-- Parameters to {{translit module documentation}}:
	-- |code|description
	-- Ignore code because we get it from the page name.
	local pagename = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	if args and get_code_from_title_without_namespace(pagename) ~= args then
		-- ]
		require("Module:debug").track("translit/input different from title")
	end
	if args then
		return export.documentation_from_code(args, args, pagename)
	else
		return export.documentation(pagename, args)
	end
end

return export