Module:ota-Armn-translit

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

This module will transliterate Ottoman Turkish language text per WT:OTA 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:ota-Armn-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 = {}
	-- Used to transliterate the ]
local gsub = require("Module:string utilities").gsub

local mapping = {
	="a", ="k", ="y", ="z", ="e", ="ı",
	="t", ="j", ="i", ="l", ="h", ="g", ="h",
	="ğ", ="c", ="m", ="y", ="n", ="ş",
	="ç", ="b", ="s", ="v", ="d", ="r",
	="p", ="k", ="ew", ="o", ="f",
	="A", ="K", ="Y", ="Z", ="E", ="I",
	="T", ="J", ="İ", ="L", ="H", ="G", ="H",
	="Ğ", ="C", ="M", ="Y", ="N", ="Ş",
	="Ç", ="B", ="S", ="V", ="D", ="R",
	="P", ="K", ="O", ="F",
	-- turning RIGHT SINGLE QUOTATION MARK (U+2019) into MODIFIER LETTER APOSTROPHE (U+02BC)
	-- the encoding ARMENIAN APOSTROPHE (U+055A) is dispreferred by the Unicode standard
	="ʼ",
	 -- not used in Turkish words
	="p", ="t", ="dz", ="ts", ="ç", ="r", ="ts", 
	="P", ="T", ="Dz", ="Ts", ="Ç", ="R", ="Ts", 
	 -- punctuation
	=",", =".", =";", ="́", ="<sup>!</sup>", ="<sup>?</sup>",
	=".", ="-", ='“', ='”',
}

local replacements = {
	)ԵԱ'] = '%1Â',
	)եա'] = '%1â', -- լեա is lya
	'] = 'U',
	 = 'u',
	'] = 'Ü',
	 = 'ü',
	'] = 'Ö',
	 = 'ö',
	'] = 'Ú',
	 = 'ú',
	'] = 'U<sup>!</sup>',
	 = 'u<sup>!</sup>',
	'] = 'U<sup>?</sup>',
	 = 'u<sup>?</sup>',
	-- '] = 'Ñ', these cannot be handled automatically
	-- '] = 'ñ', these cannot be handled automatically
}

function export.tr(text, lang, sc)
	if sc and sc ~= "Armn" then
		return nil
	end

	for regex, replacement in pairs(replacements) do
		text = gsub(text, regex, replacement)
	end

	text = gsub(text, '.', mapping)
	return text
end

return export