Difference between revisions 18626561 and 18626562 on frwiktionary

local languages = mw.loadData("Module:languages")
local export = {}

-- transliterate the text, if possible
function export.translit(lang, text)
    -- TODO: the table's information should be moved to [[Module:languages]]
    local translit_modules = {
        ["ae"] = "Module:Avst-translit",
(contracted; show full)
    
    for i, script in ipairs(scripts) do
        local script2check = script:gsub(".-%-", "") -- removes the language code from script name, e.g. "nv-Latn" > "Latn"
        if script2check == "Latf" or script2check == "Latinx" or script2check == "unicode" then
            script2check = "Latn"
        end
        
        local scriptinfo = m_scripts[script2check] or error("The script code \"" .. sc
ript .. "\" is not valid.")
        if scriptinfo.characters and mw.ustring.match(text, scriptinfo.characters) then
            return script
        end
    end
    
    -- not written in native script(s); check for all scripts
    -- TODO: This is slow; we really shouldn't be doing this!
(contracted; show full)        i = i + 1
        cat = args[i]
    end
    
    return export.format_categories(categories, lang, sort_key)
end

return export