This module will transliterate Judeo-Tat language text per WT:JDT 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:jdt-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 = {}
local tt_he_a2 = {
= "y",
= "e",
= "o",
= "a",
= "i",
}
local tt_he_dg = {
= "k",
= "k",
= "b",
= "p",
= "p",
= "c",
= "ç",
= "c",
= "ç",
}
local tt_he = {
= "ə",
= "v",
= "g",
= "d",
= "h",
= "z",
= "ħ",
= "j",
= "x",
= "x",
= "l",
= "m",
= "m",
= "n",
= "n",
= "s",
= "ḩ",
= "f",
= "f",
= "c",
= "c",
= "q",
= "r",
= "ş",
= "t",
= "t",
= ":",
= "'",
= "\"",
= "-",
}
local tt_cy_2 = {
= "H",
= "H",
= "h",
= "h",
= "Ḩ", -- palochka
= "Ḩ", -- palochka (rare lowercase)
= "Ḩ", -- Latn I
= "Ḩ", -- Cyrl І
= "Ḩ", -- Latn i
= "Ḩ", -- Cyrl і
= "ḩ", -- palochka
= "ḩ", -- palochka (rare lowercase)
= "ḩ", -- Latn I
= "ḩ", -- Cyrl І
= "ḩ", -- Latn i
= "ḩ", -- Cyrl і
= "Ħ",
= "Ħ",
= "ħ",
= "ħ",
= "Q",
= "Q",
= "q",
= "q",
= "Y",
= "Y",
= "y",
= "y",
}
local tt_cy = {
= "A", = "a",
= "B", = "b",
= "C", = "c",
= "Ç", = "ç",
= "D", = "d",
= "E", = "e",
= "Ə", = "ə",
= "F", = "f",
= "G", = "g",
= "I", = "i",
= "J", = "j",
= "K", = "k",
= "L", = "l",
= "M", = "m",
= "N", = "n",
= "O", = "o",
= "P", = "p",
= "R", = "r",
= "S", = "s",
= "Ş", = "ş",
= "T", = "t",
= "U", = "u",
= "V", = "v",
= "X", = "x",
= "Z", = "z",
}
local tt_ipa = {
= "a", = "a",
= "b", = "b",
= "tʃ", = "tʃ",
= "dʒ", = "dʒ",
= "d", = "d",
= "ɛ", = "ɛ",
= "æ", = "æ",
= "f", = "f",
= "ɡ", = "ɡ",
= "h", = "h",
= "ʕ", = "ʕ",
= "ħ", = "ħ",
= "ɪ", = "ɪ",
= "j", = "j",
= "k", = "k",
= "l", = "l",
= "m", = "m",
= "n", = "n",
= "o", = "o",
= "p", = "p",
= "ɢ", = "ɢ",
= "ɾ", = "ɾ",
= "s", = "s",
= "ʃ", = "ʃ",
= "t", = "t",
= "u", = "u",
= "v", = "v",
= "χ", = "χ",
= "y", = "y",
= "z", = "z",
}
local tt_tocy = {
= "А", = "а",
= "Б", = "б",
= "Ч", = "ч",
= "Ж", = "ж",
= "d", = "д",
= "Е", = "е",
= "Э", = "э",
= "Ф", = "ф",
= "Г", = "г",
= "Гь", = "гь",
= "ГӀ", = "гӀ",
= "Хь", = "хь",
= "И", = "и",
= "Й", = "й",
= "К", = "к",
= "Л", = "л",
= "М", = "м",
= "Н", = "н",
= "О", = "о",
= "П", = "п",
= "Гъ", = "гъ",
= "Р", = "р",
= "С", = "с",
= "Ш", = "ш",
= "Т", = "т",
= "У", = "у",
= "В", = "в",
= "Х", = "х",
= "Уь", = "уь",
= "З", = "з",
}
local tt_tohe = {
= "אַ", = "אַ",
= "בּ", = "בּ",
= "ג׳", = "ג׳",
= "ז׳", = "ז׳",
= "ד", = "ד",
= "אי", = "אי",
= "א", = "א",
= "פ", = "פ",
= "ג", = "ג",
= "ה", = "ה",
= "ע", = "ע",
= "ח", = "ח",
= "אִ", = "אִ",
= "י", = "י",
= "כּ", = "כּ",
= "ל", = "ל",
= "מ", = "מ",
= "נ", = "נ",
= "אָ", = "אָ",
= "פּ", = "פּ",
= "ק", = "ק",
= "ר", = "ר",
= "ס", = "ס",
= "ש", = "ש",
= "ת", = "ת",
= "אוּ", = "אוּ",
= "ב", = "ב",
= "כ", = "כ",
= "או", = "או",
= "ז", = "ז",
}
-- Keep in mind RTL issues when viewing the following:
local he_to_final = {
= "ך",
= "ם",
= "ן",
= "ף",
= "ץ",
}
local function tr_he(text)
text = mw.ustring.gsub(text, "אוּ", "u")
text = mw.ustring.gsub(text, ".%f.", tt_he_a2)
text = mw.ustring.gsub(text, ".%f.", tt_he_dg)
text = mw.ustring.gsub(text, ".", tt_he)
return text
end
local function tr_cy(text)
text = mw.ustring.gsub(text, ".%f.", tt_cy_2)
text = mw.ustring.gsub(text, ".", tt_cy)
return text
end
function export.tr(text, lang, sc)
if not sc then
sc = require("Module:languages").getByCode(lang or "jdt"):findBestScript(text):getCode()
end
if sc == "Hebr" then
text = tr_he(text)
elseif sc == "Cyrl" then
text = tr_cy(text)
else
text = nil
end
return text
end
function export.ipa(text, lang, sc)
if type(text) == 'table' then
local args = text:getParent().args
text = args ~= "" and args or mw.title.getCurrentTitle().subpageText
lang = args ~= "" and args or "jdt"
sc = args ~= "" and args
end
return (mw.ustring.gsub(export.tr(text, lang, sc) or text, ".", tt_ipa))
end
function export.la(text, lang, sc)
if type(text) == 'table' then
local args = text:getParent().args
text = args ~= "" and args or mw.title.getCurrentTitle().subpageText
lang = args ~= "" and args or "jdt"
sc = args ~= "" and args
end
return (export.tr(text, lang, sc) or text)
end
function export.cy(text, lang, sc)
if type(text) == 'table' then
local args = text:getParent().args
text = args ~= "" and args or mw.title.getCurrentTitle().subpageText
lang = args ~= "" and args or "jdt"
sc = args ~= "" and args
end
return (mw.ustring.gsub(export.tr(text, lang, sc) or text, ".", tt_tocy))
end
local function he_finals_replacer(letter, rest)
return (he_to_finals .. rest)
end
local function he_finals(text)
-- Keep in mind RTL issues when viewing the following pattern:
text = mw.ustring.gsub(text, "()(-%f)", he_finals_replacer)
return text
end
function export.he(text, lang, sc)
if type(text) == 'table' then
local args = text:getParent().args
text = args ~= "" and args or mw.title.getCurrentTitle().subpageText
lang = args ~= "" and args or "jdt"
sc = args ~= "" and args
end
return he_finals(mw.ustring.gsub(export.tr(text, lang, sc) or text, ".", tt_tohe))
end
return export