This module will transliterate text in the Cherokee script. It is used to transliterate Cherokee.
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.
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 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.syl_list) do
for i, cher in ipairs(v) do
text = gsub(text, cher, c .. m_cher.vowel_order)
end
end
-- handle special cases for Ꮐ and Ꮝ
text = gsub(text, "Ꮐna", "Ꮐ'na") -- add apostrophe between Ꮐ and Ꮎ
text = gsub(text, "Ꮝ()", "Ꮝ'%1") -- add apostrophe between Ꮝ and a vowel
text = gsub(text, ".", { = "nah", = "s"}) -- then substitute those values
return text
end
return export