Module:zkt-translit

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

This module will transliterate Khitan 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:zkt-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 data = mw.loadData("Module:zkt-translit/data")

function export.tr(text, lang, sc)
	-- Remove text formatting.
	text = text:gsub("\244", "")
	
	local trtab = {}
	
	i = 0
	for char in mw.ustring.gmatch(text, ".") do
		i = i + 1
		if char == "𘬀" and i > 1 then
			table.insert(trtab, trtab)
		else
			table.insert(trtab, data or "?")
		end
	end
	local check = table.concat(trtab)
	_, count = mw.ustring.gsub(check, "?", "")
	if count == mw.ustring.len(check) then
		return nil
	else
		return "*" .. table.concat(trtab, " ")
	end
end

return export