Module:fulf-translit: Difference between revisions

From Linguifex
Jump to navigation Jump to search
Melinoë (talk | contribs)
No edit summary
Melinoë (talk | contribs)
Replaced content with "-- ts doesn't work, not bothering with it more"
Tag: Replaced
 
Line 1: Line 1:
local export = {}
-- ts doesn't work, not bothering with it more
 
--Contributors: Malku H₂n̥rés, Sartma, Erutuon, Metaknowledge
 
local m_str_utils = require("Module:string utilities")
 
local gcodepoint = m_str_utils.gcodepoint
local match = m_str_utils.match
local s = m_str_utils.gsub
local U = m_str_utils.char
 
local bidirectional_control_characters =
U(0x061C) .. U(0x200E) .. U(0x200F) .. U(0x202A) .. "-" .. U(0x202E)
.. U(0x2066) .. "-" .. U(0x2069)
local word_end = "%f[%s%z" .. bidirectional_control_characters .. "%-]"
local word_start = "%f[^%s%z" .. bidirectional_control_characters .. "%-]"
-- Bidirectional control characters should be avoided as much as possible,
-- but they are easily picked up when copying and pasting, so the module needs
-- to account for them.
-- This list is from [[w:Bidirectional control character]].
 
local V = "[aeiou‌āēīōū][̂̄̆]?́?"
local C = "[ʔḇḡḏhwzḥṭylsʕqrśšṯ'ḵmnfṣbdgptkjc″vḫẓġTZCDK]"
 
local c = { --direct translit
--full char ie. C
    ["א"] = "ʔ",
    ["ב"] = "ḇ",
    ["ג"] = "ḡ",
    ["ד"] = "ḏ",
    ["ה"] = "h",
    ["ו"] = "w",
    ["ז"] = "z",
    ["ח"] = "ḥ",
    ["ט"] = "ṭ",
    ["י"] = "y",
    ["ל"] = "l",
    ["ס"] = "s",
    ["ע"] = "ʕ",
    ["ק"] = "q",
    ["ר"] = "r",
    ["ש"] = "š",
    ["ת"] = "ṯ",
--miscellaneous:
["׳"] = "'", --geresh
    ["־"] = "-", --hyphen
    ["׃"] = " .", --dot
    ["ּ"] = "·", --dagesh
["ֽ"] = "+", --meteg
--niqqud ie. V
["ַ"] = "a",
["ָ"] = "ɔ",
["ֶ"] = "ɛ",
["ֵ"] = "e",
["ִ"] = "i",
["ֳ"] = "ɔ̆",
["ֲ"] = "ă",
["ֱ"] = "ɛ̆",
["ְ"] = "ü",
["ֹ"] = "o",
["ֺ"] = "o",
["ֻ"] = "u",
["ׇ"] = "ɔ",
}
 
local b = { --BH
--bgdkft: fricative + dagesh > stop
{"ḇ·", "b"},
{"ḡ·", "g"},
{"ḏ·", "d"},
{"ṯ·", "t"},
{"ḵ·", "k"},
{"f·", "p"},
--vowel lengthenings
{"ey", "ē%1"},
{"ow", "ō%1"},
{"aʔ", "ā%1"},
{"iy", "ī%1"},
{"uw", "ū%1"},
{"ē(" .. V .. ")", "ey%1"},
{"ō(" .. V .. ")", "ow%1"},
{"ī(" .. V .. ")", "iy%1"},
{"ū(" .. V .. ")", "uw%1"},
}
 
 
function export.tr(text, lang, sc)
if not sc then
sc = require("Module:languages").getByCode(lang, nil, true):findBestScript(text):getCode()
end
if sc ~= "Hebr" or not match(text, "[ְ-ֻ־ׇ״]") then
return nil
elseif lang == "fulf" then
return export.b(text)
elseif lang == "hbo" then --though useless
return export.b(text)
end
end
 
function export.tr_all(frame)
return export.b(frame.args[1]) .. ", "
end
 
return export

Latest revision as of 06:31, 28 June 2026


This module will transliterate Fulfathic language text. 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:fulf-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.

-- ts doesn't work, not bothering with it more