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.
tr(text, lang, sc)
text
written in the script specified by the code sc
, and language specified by the code lang
.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