Module:ar-dialect-utilities

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


local export = {}

local sc = require("Module:scripts").getByCode("Arab")
local m_utilities = require("Module:utilities")
local m_links = require("Module:links")
local m_headword = require("Module:headword")
local rsplit = mw.text.split
local lang

function export.catfix() return m_utilities.catfix(lang, sc) end

local function link(term, tr, gloss, face, alt)
    if word == "" or word == "—" then
        return word
    else
        return m_links.full_link({
            term = term,
            alt = alt,
            lang = lang,
            tr = tr,
            sc = sc,
            gloss = gloss
        }, face)
    end
end

local function validateRoot(rootTable, joined_root)
    if type(rootTable) ~= "table" then error("rootTable is not a table", 2) end

    for i, letter in ipairs(rootTable) do
        if mw.ustring.len(letter) > 1 then
            error("'" .. letter .. "', the " .. ordinal ..
                      " letter in the root '" .. joined_root ..
                      "' should be a single letter.")
        end
    end
end

function export.root(frame)
    local output = {}
    local categories = {}
    local title = mw.title.getCurrentTitle()
    local fulltitle = title.fullText
    local pagename = title.text
    local namespace = title.nsText

    local params = {
         = {},
         = {type = "boolean"},
         = {type = "boolean"},
         = {},
         = {alias_of = "t"},
         = {type = "boolean"},
         = {type = "boolean"},
         = {},
         = {},
         = {},
    }

    local args = require("Module:parameters").process(frame:getParent().args,
                                                      params)
                                                      
	lang = require("Module:languages").getByCode(args)
    local rootLetters = {}

    if not args and namespace == "Template" then
        rootLetters = {"ك", "ت", "ب"}
    elseif args then
        rootLetters = rsplit(args, " ")
    else
        rootLetters = rsplit(fulltitle, " ")
    end

    local joined_root = table.concat(rootLetters, " ")
    validateRoot(rootLetters, joined_root)

    if fulltitle == joined_root then
        table.insert(output, m_headword.full_headword(
                         {
                lang = lang,
                sc = sc,
                pos_category = "roots",
                categories = {},
                heads = {joined_root}
            }))

        table.insert(categories, " or joined_root) .. "]]")

        if args then
            return table.concat(output)
        else
            return table.concat(output) .. table.concat(categories)
        end

    else
        local link_text

        if args then
            link_text = link(nil, args, args, joined_root)
        else
            link_text = link(joined_root, args, args)
        end

        table.insert(output, link_text)

        table.insert(categories, m_utilities.format_categories(
                         {lang.getCanonicalName() .. " terms belonging to the root " .. joined_root},
                         lang))

        if args then
            return table.concat(output)
        elseif args then
            return table.concat(output)
        else
            return "<table class=\"wikitable\" style=\"float: right; clear: right; text-align: center;\"><tr><th>]</th></tr><tr><td>" .. link_text .. "</td></tr></table>" .. table.concat(categories)
        end

    end

end

return export