Module:sah-translit

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

This module will transliterate Yakut language text per WT:SAH 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:sah-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', ='a', ='B', ='b', ='G', ='g', ='Ğ', ='ğ',
	='D', ='d', ='İ', ='i', ='Y', ='y', ='K', ='k',
	='L', ='l', ='M', ='m', ='N', ='n', ='Ñ', ='ñ',
	='O', ='o', ='Ö', ='ö', ='P', ='p', ='R', ='r',
	='S', ='s', ='H', ='h', ='T', ='t', ='U', ='u',
	='Ü', ='ü', ='Q', ='q', ='C', ='c', ='I', ='ı', 
	='E', ='e',
	-- non-native letters
	='V', ='v', ='E', ='e', ='O', ='o', ='Zh', ='zh',
	='Z', ='z', ='F', ='f', ='Ts', ='ts', ='Sh', ='sh', 
	='Shc', ='shc', ='', ='', ="", ="", ='U', ='u', 
	='A', ='a',
}
 
function export.tr(text, lang, sc)
    text = mw.ustring.gsub(text, 'Дь', 'J')
    text = mw.ustring.gsub(text, 'дь', 'j')
    text = mw.ustring.gsub(text, 'НЬ', 'NY')
    text = mw.ustring.gsub(text, 'Нь', 'Ny')
    text = mw.ustring.gsub(text, 'нь', 'ny')
    
    -- soft vowels after a vowel or at the beginning of a word become j-
    text = mw.ustring.gsub(text, "(?)()", "%1y%2")
    text = mw.ustring.gsub(text, "^()", "Y%1")
    text = mw.ustring.gsub(text, "^()", "y%1")
 
    return (mw.ustring.gsub(text,'.',tab))
end

return export