Module:Cher-translit
Itsura
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate text in the Katitikang Cherokee. It is used to transliterate Tseroki.
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:Cher-translit/testcases.
Functions
[baguhin]tr(text, lang, sc)- Transliterates a given piece of
textwritten in the script specified by the codesc, and language specified by the codelang. - When the transliteration fails, returns
nil.
local export = {}
local m_cher = require("Module:Cher-common")
local m_str_utils = require("Module:string utilities")
local gsub = m_str_utils.gsub
-- transliteration export function
function export.tr(text, lang, sc)
-- ensure all Cherokee characters are uppercase
text = m_str_utils.upper(text)
-- substitute values generatively from syllable list dictionary
for c, v in pairs(m_cher.syll_list) do
for i, cher in ipairs(v) do
text = gsub(text, cher, c .. m_cher.vowel_order[i])
end
end
-- handle special cases for Ꮐ and Ꮝ
text = gsub(text, "Ꮐna", "Ꮐ'na") -- add apostrophe between Ꮐ and Ꮎ
text = gsub(text, "Ꮝ([aeiouv])", "Ꮝ'%1") -- add apostrophe between Ꮝ and a vowel
text = gsub(text, ".", {["Ꮐ"] = "nah", ["Ꮝ"] = "s"}) -- then substitute those values
return text
end
return export