Module:cjs-translit

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

This module will transliterate Shor language text per WT:CJS 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:cjs-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 tab = {
	="A", ="B", ="V", ="G", ="Ĝ", ="D", ="E", ="Yo", ="Ž", ="Z", ="I", ="Y", ="J̌]", ="J̌]]",
	="K", ="K̂", ="L", ="M", ="N", ="Ŋ", ="Ŋ]", ="O", ="Ö", ="Ö]", ="P", ="R", ="S", ="T",
	="U", ="Ü", ="F", ="H", ="C", ="Č", ="Š", ="Šč", ="ʺ", ="Ï", ="ʹ",
	="E", ="Yu", ="Ya",
	='a', ='b', ='v', ='g', ="ĝ", ='d', ='e', ='yo', ='ž', ='z', ='i', ='y', ="ǰ]", ="ǰ]]",
	='k', ='k̂', ='l', ='m', ='n', ='ŋ', ='ŋ]', ='o', ='ö', ='ö]', ='p', ='r', ='s', ='t',
	='u', ='ü', ='f',
	='h', ='c', ='č', ='š', ='šč', ='ʺ', ='ï', ='ʹ', ='e', ='yu', ='ya',
}

function export.tr(text, lang, sc)
	-- Ё needs converting if is decomposed
	text = text:gsub("ё","ё"):gsub("Ё","Ё")
	
	-- е after a vowel or at the beginning of a word becomes ye
	-- Note that according to modern Shor orthography ее (instead of ээ) is occationally used for long e
	text = mw.ustring.gsub(text, "(?)е","%1ye")
	--text = mw.ustring.gsub(text, "(?)е","%1ye")
	text = mw.ustring.gsub(text, "^Е","Ye")
	text = mw.ustring.gsub(text, "^е","ye")
	text = mw.ustring.gsub(text, "()Е","%1Ye")
	text = mw.ustring.gsub(text, "()е","%1ye")
	
	return (mw.ustring.gsub(text,'.',tab))
end
 
return export