Difference between revisions 18626533 and 18626534 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)        ["ug-Arab"] = "ۈۇې",        
        -- TODO
    }
    
    -- first try to detect the script based on the native scripts of the language
    local scripts = languages[lang].scripts or {}
    for i, script in ipairs(scripts) do
        if chars_table[script] and mw.ustring.match(text, "[
%[%*%d%p%s]-[" .. chars_table[script] .. "]") then
            return script
        end
    end
    
    -- not written in native scripts; check for all scripts
    for script, chars in ipairs(chars_table) do
        if mw.ustring.match(text, "[%[%d%p%s]-[" .. chars .. "]") then
(contracted; show full)        i = i + 1
        cat = args[i]
    end
    
    return export.format_categories(categories, lang, sort_key)
end

return export