This module will transliterate Mozarabic 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:mxi-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 = {};
function export.tr(text, lang, sc)
local replacements;
if (sc == 'Arab') then
return mw.ustring.gsub(mw.ustring.gsub(text, '.', {
-- consonants --
='ə', ='b', ='t', ='ṯ', ='j',
='ḥ', ='ḵ', ='d', ='ḏ', ='r',
='z', ='s', ='š', ='ṣ', ='ḍ',
='ṭ', ='ẓ', ='ʕ', ='ḡ', ='f',
='q', ='k', ='l', ='m', ='n',
='h', ='w', ='y',
-- , and should not occur, but sometimes does
='n',
-- should likely be used in quotes at least
='y',
-- tashkil --
='a', ='u', ='i',
='ː', ='°',
}), '()ə', '%1ā'):gsub('aə', 'ā');
elseif (sc == 'Hebr') then
return mw.ustring.gsub(text, '.', {
-- consonants --
= 'ʔ', = 'b', = 'g', = 'd',
= 'h', = 'w', = 'z', = 'ḥ',
= 'ṭ', = 'y', = 'k', = 'l',
= 'm', = 'n', = 's', = 'ʕ',
= 'f', = 'ṣ', = 'q', = 'r',
= 'š', = 't',
-- sofit --
= 'k', = 'm', = 'n', = 'f',
= 'ṣ',
-- nikud ?
});
end
return ;
end
return export;