Module:ks-translit

Hello, you have come here looking for the meaning of the word Module:ks-translit. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:ks-translit, but we will also tell you about its etymology, its characteristics and you will know how to say Module:ks-translit in singular and plural. Everything you need to know about the word Module:ks-translit you have here. The definition of the word Module:ks-translit will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:ks-translit, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

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.

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.

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