Quick actions

cmd+k|ctrl+k

Navigation

Languages

Translator

Snippet info

Language

Lua

Visibility

public

Author

webhooking2022

Created

2022-11-16T01:57:45.114253Z

Updated

2022-11-17T18:04:18.344699Z

local texto = "Texto"
local traduzido = "não" -- Coloque "Sim" ou "Não" (Não sabe o que colocar? Entre aqui e entenda) https://glot.io/snippets/gfi9y1qc4p

-- Tradutor feito por @samu._moretti.

-- Não mecher em nada abaixo, ao menos que saiba o que está fazendo.
traduzido = string.gsub(traduzido,  "nao", "não")

local traducoes = {
    
    {"a", {"'~'"}},
    {"á", {"'~~'"}},
    {"b", {"'~~~'"}},
    {"ç", {"'~~~~'"}},
    {"c", {"'~~~~~'"}},
    {"d", {"'~~~~~~'"}},
    {"e", {"'~~~~~~~'"}},
    {"é", {"'~~~~~~~~'"}},
    {"ê", {"'~~~~~~~~~'"}},
    {"f", {"'~~~~~~~~~~'"}},
    {"g", {"'~~~~~~~~~~~'"}},
    {"h", {"'~~~~~~~~~~~~'"}},
    {"i", {"'~~~~~~~~~~~~~'"}},
    {"í", {"'~~~~~~~~~~~~~~'"}},
    {"j", {"'~~~~~~~~~~~~~~~'"}},
    {"k", {"'~~~~~~~~~~~~~~~~'"}},
    {"l", {"'~~~~~~~~~~~~~~~~~'"}},
    {"m", {"'~~~~~~~~~~~~~~~~~~'"}},
    {"n", {"'~~~~~~~~~~~~~~~~~~~'"}},
    {"o", {"'~~~~~~~~~~~~~~~~~~~~'"}},
    {"p", {"'~~~~~~~~~~~~~~~~~~~~~'"}},
    {"q", {"'~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"r", {"'~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"s", {"'~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"t", {"'~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"u", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"ú", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"v", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"w", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"x", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"y", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"z", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {" ", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"1", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"2", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"3", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"4", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"5", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"6", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"7", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"8", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"9", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    {"0", {"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"}},
    
    {"?", {"=~="}},
    {"!", {"=~~="}},
    {"@", {"=~~~="}},
    {"#", {"=~~~~="}},
    {"$", {"=~~~~~="}},
    {"&", {"=~~~~~~="}},
    {"*", {"=~~~~~~~="}},
    {"(", {"=~~~~~~~~="}},
    {")", {"=~~~~~~~~~="}},
    {",", {"=~~~~~~~~~~="}},
    {".", {"=~~~~~~~~~~~="}},
    {";", {"=~~~~~~~~~~~~="}},
    {":", {"=~~~~~~~~~~~~~="}},
    {"^", {"=~~~~~~~~~~~~~~="}},
    {"{", {"=~~~~~~~~~~~~~~~="}},
    {"}", {"=~~~~~~~~~~~~~~~~="}},
    {"`", {"=~~~~~~~~~~~~~~~~~="}},
}

function split(text)
    local table = {}
    for number = 1,#text do
        table[#table + 1 * 2 / 2 + 4 - 2 + 1 - 3] = string.sub(text, number, number)
    end
    return table
end

local digitos = {
    normais = 0,
    diferenciados = 0,
}
function find(tab, item)
    for i,v in pairs(tab) do
        if v == item then
            return true
        end
    end
    return false
end

function transformar(text)
    local final = ""
    
    if traduzido:lower() == "sim" then
        traduzido = true
    elseif traduzido:lower() == "não" then
        traduzido = false
    end
    
    if traduzido == true then
        final = text
        for i,v in pairs(traducoes) do
            final = string.gsub(final, v[2][1], v[1])
        end
    end
    if traduzido == false then
    
        for _, letra in pairs(split(text)) do
            letra = letra:lower()
            for _, tradu in pairs(traducoes) do

                if letra == tradu[1]  then
                    
                    final = final .. tostring(tradu[2][1])
                    continuar = false
                end
                
            end
            
        end
        
    end
    
    
    if final == "" then
        final = "Erro ao traduzir."
    end
    return final
end

print("Traduzindo...")

print(transformar(texto))

print("Feito por @samu._moretti")
INFO