Module:lbe-translit

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

This module will transliterate Lak language text per WT:LBE 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:lbe-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 export = {}

local tt = {
	="b", ="p", ="f", ="w", ="m",
	="d", ="t", ="y", ="n", ="z", ="c",
	="s", ="ž", ="š", ="š:", 
	="l", ="č", ="r", ="g", ="k", ="x", 
	="ʼ", ="a", ="e", ="i", ="o", ="u", 
	="e", ="uˤ", ="aˤ",
	="B", ="P", ="F", ="W", ="M",
	="D", ="T", ="Y", ="N", ="Z", ="C",
	="S", ="Ž", ="Š", ="Š:", 
	="L", ="Č", ="R", ="G", ="K", ="X", 
	="ʼ", ="A", ="E", ="I", ="O", ="U", 
	="E", ="Uˤ", ="Aˤ"};

local tetragraphs = {
	 = 'x̂:',
	 = 'X̂:',
}

local digraphs = {
	 = 'p:',
	 = 'pʼ',
	 = 't:', 
	 = 'ä',
	 = 'oˤ',
	 = 'P:',
	 = 'Pʼ',
	 = 'T:',
	 = 'Ä',
	 = 'Oˤ',
	 = 'cʼ',
	 = 'c:',
	 = 'tʼ',
	 = 's:',
	 = 'č:',
	 = 'čʼ',
	 = 'qʼ',
	 = 'k:',
	 = 'kʼ',
	 = 'x̂',
	 = 'q',
	 = 'q:',
	 = 'ğ',
	 = 'x:',
	 = 'ħ',
	 = 'h',
	 = 'Cʼ',
	 = 'C:',
	 = 'Tʼ',
	 = 'S:',
	 = 'Č:',
	 = 'Čʼ',
	 = 'Qʼ',
	 = 'K:',
	 = 'Kʼ',
	 = 'X̂',
	 = 'Q',
	 = 'Q:',
	 = 'Ğ',
	 = 'X:',
	 = 'Ħ',
	 = 'H',
}

function export.tr(text, lang, sc)
	local str_gsub = string.gsub
	local UTF8_char = '*'
	
	-- Convert capital to lowercase palochka. Lowercase is found in tables
	-- above.
	text = str_gsub(text, u(0x4C0), u(0x4CF))
	
	for tetragraph, replacement in pairs(tetragraphs) do
		text = str_gsub(text, tetragraph, replacement)
	end
	
	for digraph, replacement in pairs(digraphs) do
		text = str_gsub(text, digraph, replacement)
	end
	
	text = str_gsub(text, UTF8_char, tt)
	
	return text
end

return export