Module:User:DTLHS/translations

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


local m_links = require("Module:links")
local languages = mw.loadData("Module:languages")

local export = {}

function build_translation(t_params, frame, langcode, langinfo)
    -- modified from Module:translations
    
    local interwiki = t_params or ""
    if interwiki == "" or interwiki == "-" then
        interwiki = "tneg"
    elseif interwiki == "+" then
        interwiki = "tpos"
    end
    
    NAMESPACE = mw.title.getCurrentTitle().nsText
    local ret = ""
    local categories = {}
 
    local sc = t_params or ""; if sc == "" then sc = langinfo.scripts end
    
    local lang = langcode
    local term = t_params or (NAMESPACE == "Template" and "term") or error("Term has not been specified.")
    local alt = t_params; if alt == "" then alt = nil end
 
    local tr = t_params; if tr == "" then tr = nil end
    local qualifier = t_params; if qualifier == "" then qualifier = nil end
    if qualifier ~= nil then
        qualifier = frame:expandTemplate{ title = "qualifier", args = mw.text.split(qualifier, ",") }
    end
    
    -- Interwiki link
    local interwiki_langs = {
         = "zh-min-nan",
         = "zh-yue",
         = "zh",
         = "no",
         = "roa-rup",
         = "ku",
         = "nds",
         = "nds",
         = "nds" }
 
    -- Don't show the link if the language is not recognised by MediaWiki
    -- or if the term contains links (for SOP translations)
    if term:find(" or lang) then
        interwiki = false
    end
 
    -- If no transliteration was given, try auto-transliteration if available.
    -- This information should really be in Module:languages, but for now it works.
    local has_auto_translit = {
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true }
    local needs_translit = {
         = true, 
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true, 
         = true, 
         = true,
         = true,
         = true, 
         = true,
         = true, 
         = true, 
         = true,
         = true,
         = true,
         = true,
         = true, 
         = true, 
         = true, 
         = true, 
         = true, 
         = true, 
         = true, 
         = true, 
         = true, 
         = true,
         = true,
         = true, 
         = true, 
         = true, 
         = true, 
         = true,
         = true, 
         = true,
         = true,
         = true,
         = true,
         = true,
         = true, 
         = true, 
         = true,
         = true,
         = true, 
         = true, 
         = true, 
         = true, 
         = true,
         = true,
         = true,
         = true,
         = true, 
         = true, 
         = true, 
         = true,
         = true, 
         = true,
         = true, 
         = true,
         = true,
         = true,
         = true,
         = true,
         = true, 
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true, 
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true,
         = true, 
         = true, 
         = true,
         = true,
         = true,
         = true, 
         = true,
         = true}
 
    if not tr and has_auto_translit then
        local translit_module = require("Module:" .. lang .. "-translit")
        tr = translit_module.tr(alt or term)
    end
 
    -- Gender and number
    -- Iterate over all numbered parameters starting from 3, until one is empty.
    local genders = {}
    local g = t_params or ""
    
    if g ~= "" then
        if mw.ustring.find(g, "?", nil, true) then
            table.insert(categories, langinfo.names .. " terms with incomplete gender")
        end
        table.insert(genders, g)
    end
    
    -- Show the term
    ret = ret .. frame:expandTemplate{ title = sc, args = { m_links.language_link(term, alt, lang), lang = lang } }
 
    -- Show the interwiki link
    if interwiki then
        ret = ret .. "<span class=\"" .. interwiki .. "\">&nbsp; or lang) .. ":" .. term .. "|(" .. (interwiki_langs or lang) .. ")]]</span>"
    end
 
    -- Show transliteration
    if tr then
        ret = ret .. " (" .. tr .. ")"
    elseif needs_translit then
        table.insert(categories, langinfo.names .. " translations lacking transliteration")
    end
 
    -- Show the genders
    if genders then
        local gen = require("Module:gender and number")
        ret = ret .. " " .. gen.format_list(genders)
    end
    
    -- Add qualifier
    if qualifier then
        ret = ret .. " " .. qualifier .. ""
    end
    
    -- Add the categories
    for key, cat in ipairs(categories) do
        ret = ret .. "]"
    end
 
    return ret
end

function export.show(frame)
    local args = frame:getParent().args
    
    local t_args = {}
    local langinfo_t = {}
    local langname_t = {}
    
    for i, v in pairs(args) do
        if type(i) ~= "number" then
            s = mw.text.split(i, '_')
            
            langcode = s
            if langinfo_t == nil then
                langinfo = languages or error("The language code \"" .. lang .. "\" is not valid.")
                langinfo_t = langinfo
                
            end
            langname = langinfo_t
            langname_t = langcode
            
            t = s
            n = s
            
            if t_args == nil then
                t_args = {}
            end
            
            if t_args == nil then
                t_args = {}
            end

            t_args = v
            
        end
    end

    local result_t = {}
    
    -- nest t based on sc parameter
    local script_nesting = {
         = { = "Cyrillic",  = "Roman",  = "Arebica"},
         = { = "Kurmanji",  = "Sorani"},
         = { = "Hebrew",  = "Syriac"},
         = { = "Arabic",  = "Devanagari"},
         = { = "Cyrillic",  = "Glagolitic"},
         = { = "Latin",  = "Cyrillic"}
    }
    
    -- nest languages that have a distinct code
    local language_nesting = {
         = {"el"},
         = {"el"},
         = {"ar",  = "Algerian"},
         = {"ar",  = "Andalusian"},
         = {"ar",  = "Bahrani"},
         = {"ar",  = "Chadian"},
         = {"ar",  = "Egyptian"},
         = {"ar",  = "Gulf"},
         = {"ar",  = "Hassānīya"},
         = {"ar",  = "Iraqi"},
         = {"ar",  = "Lebanese"},
         = {"ar",  = "Libyan"},
         = {"ar",  = "Moroccan"},
         = {"ar",  = "Sudanese"},
         = {"sq",  = "Gheg"},
         = {"bua",  = "Buryar"},
         = {"fr"},
         = {"fr"},
         = {"de",  = "Kölsch"},
         = {"de",  = "Swiss German"},
         = {"lt"},
         = {"nds"},
         = {"nds"},
         = {"mn"},
         = {"no"},
         = {"no"},
         = {"sc"},
         = {"es"}
    }
    
    -- nest under a macro language that has no code of its own
    local macro_nesting = {
         = "Chinese",
         = "Chinese",
         = "Chinese",
         = "Chinese",
         = "Chinese",
         = "Chinese",
         = "Chinese",
         = "Chinese",
         = "Lenape",
         = "Lenape",
         = "Sorbian",
         = "Sorbian"
    }
    
    -- nest based on dialect parameter (where dialect has no distinct code)
    local dialect_nesting = {
         = {"Tosk"},
         = {"Bohairic", "Sahidic"},
         = {"Aukštaitian"},
         = {"Rumi", "Jawa"},
         = {"Nugorese"},
         = {"Asalemi"}
    }
    
    for langname, translation_data in pairs(t_args) do
        
        local langcode = langname_t
        
        if language_nesting == nil then
            if result_t == nil then
                result_t = { = "* " .. langname .. ":"}
            end
        end
        
        if script_nesting == nil and language_nesting == nil then
            for translation_number, t_params in pairs(translation_data) do
                result_t = result_t .. " " .. build_translation(t_params, frame, langcode, langinfo_t) .. ","
            end
            result_t = string.sub(result_t, 0, #result_t - 1)
        end
        if script_nesting ~= nil then
            for scriptcode, scriptname in pairs(script_nesting) do
                result_t = "*: " .. scriptname .. ":"
                for translation_number, t_params in pairs(translation_data) do
                    t_sc = t_params or "Latn"
                    if t_sc == scriptcode then
                        result_t = result_t .. " " .. build_translation(t_params, frame, langcode, langinfo_t) .. ","
                    end
                end
                result_t = string.sub(result_t, 0, #result_t - 1)
            end
        end
        if language_nesting ~= nil then
            parent_langcode = language_nesting
            parent_langname = languages
            if result_t == nil then
                result_t = { = "* " .. parent_langname .. ":"}
            end
            if language_nesting ~= nil then
                langname = language_nesting
            end
            result_t = "*: " .. langname .. ":"
            for translation_number, t_params in pairs(translation_data) do
                result_t = result_t .. " " .. build_translation(t_params, frame, langcode, langinfo_t) .. ","
            end
            result_t = string.sub(result_t, 0, #result_t - 1)
        end
    end
    
    result_t_keys = {}
    for i in pairs(result_t) do table.insert(result_t_keys, i) end
    
    table.sort(result_t_keys)
    
    local result = ""
    for i1, v1 in pairs(result_t_keys) do
        for i2, v2 in pairs(result_t) do
            result = result .. v2 .. "\n"
        end
    end
    
    return result
end

return export