Module:cv-translit

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

This module will transliterate Chuvash language text per WT:CV TR. 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:cv-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 u = require("Module:string/char")
local ugsub = mw.ustring.gsub

local export = {}

local CARONBELOW = u(0x032c)

local tt = {
	="A", ="a", ="Ă", ="ă", ="B", ="b", ="V", ="v", ="G", ="g",
	="D", ="d", ="E", ="e", ="Jo", ="jo", ="Ĕ", ="ĕ", ="Ž", ="ž",
	="Z", ="z", ="I", ="i", ="J", ="j", ="K", ="k", ="L", ="l",
	="M", ="m",="N", ="n", ="O", ="o", ="P", ="p", ="R", ="r",
	="S", ="s", ="Ś", ="ś", ="T", ="t", ="U", ="u", ="Ü", ="ü",
	="F", ="f", ="H", ="h", ="Ts", ="ts", ="Č", ="č", ="Š", ="š",
	="Šč", ="šč", ="ʺ", ="ʺ", ="Y", ="y", ="ʹ", ="ʹ", ="E", ="e",
	="Ju", ="ju", ="Ja", ="ja"
};

local VOWEL1 = ""
local CONS = ""
local VOWEL2 = ""
local CHARC = ""

function export.tr(text, lang, sc)
	text = ugsub(text, "(" .. VOWEL1 .. CHARC .. "?" .. CONS .. ")(" .. CHARC .. "?)%f" .. VOWEL2, "%1" .. CARONBELOW .. "%2")
    text = ugsub(text, ".", tt)
    return text
end

return export