Difference between revisions 18626570 and 18626571 on frwiktionary

local m_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)
        return langinfo.scripts[1], scFix
    end
    
    for i, script in ipairs(langinfo.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"

        elseif script2check == "Hans" or script2check == "Hant" then
            script2check = "Hani"
        end
        
        local scriptinfo = m_scripts[script2check] or error("The script code \"" .. script .. "\" is not valid.")
        if scriptinfo.characters and mw.ustring.match(text, scriptinfo.characters) then
            return script, scFix
        end
    end
    
(contracted; show full)        i = i + 1
        cat = args[i]
    end
    
    return export.format_categories(categories, lang, sort_key)
end

return export