This module will transliterate Kashmiri 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:ks-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_str_utils = require("Module:string utilities")
local gsub = m_str_utils.gsub
local u = m_str_utils.char
local conv = {
-- regular consonants
= 'b',
= 'p',
= 't',
= 'ṭ',
= 'j',
= 'c',
= 'd',
= 'ḍ',
= 'r',
= 'ḍ',
= 'z',
= 'ts',
= 's',
= 'sh',
= 'f',
= 'k',
= 'g',
= 'l',
= 'm',
= 'n',
= 'h',
= 'h',
-- always word-final
= 'y',
-- arabic specific letters
= 'th',
= 'ḥ',
= 'ẖ',
= 'ḏ',
= 'ṣ',
= 'ḍ',
= 'ṭ',
= 'ẓ',
= 'ʿ',
= 'ġ',
= 'q',
-- palatalisation
= '\'',
-- broken vowels
= 'wa',
= 'ya',
-- a carries long vowels
= 'èa',
= 'aa',
-- numerals
= '0',
= '1',
= '2',
= '3',
= '4',
= '5',
= '6',
= '7',
= '8',
= '9'
}
local short_vowels = {
-- high vowels
= 'i',
= 'ì',
= 'u',
-- central vowels
= 'è',
-- low vowels
= 'a'
}
local y_diacritics = {
-- /e/
= '',
-- /i:/
= ''
}
local w_diacritics = {
-- /o/
= '',
-- /u:/
= ''
}
local a_diacritics = {
-- long closed central vowel
= ''
}
local C_diacritics = { -- this is just the short vowel marker set
}
local n_diacritics = {
-- /n/ nasalise preceding vowel, no following vowel
= ''
}
local r_diacritics = {
-- /r/ cancel preceding vowel
= ''
}
local alif = 'ا'
local waw = 'و'
local ye = 'ی'
function export.tr(text, lang, sc)
text = gsub(text,
'(?)' ..
'(?)', function(c, d)
if d == "" then
return conv
else
return conv .. short_vowels
end
end)
text = gsub(text, '.', conv)
return text
end
return export