Universal script translator
Key RequiredUniversal

Universal script translator

Universal ScriptTermux_404Termux_404 1.3K views 679 executesUpdated Apr 2, 2026
4.2/ 5(6 votes)
5183% Positive
Lua Script•70 lines (2103 chars)
-- [ ======== Define your texts in ENGLISH in the table below ======== ] --

local Translations = {
	Apple = "Apple",
	Hi = "Hey Guys!",
	Test = "This is a test XD",
	Credits = "Created by Termux_404, Open source :D"
}

-- [ ======== Source (no changes needed) ======== ] --

local cloneref = cloneref or function(o) return o end
local HttpService = cloneref(game:GetService("HttpService"))
local Players = cloneref(game:GetService("Players"))

pcall(function()
    if Players.LocalPlayer.LocaleId:lower() ~= "en-us" then
        local lang = Players.LocalPlayer.LocaleId:sub(1, 2)
        local completed, keys, texts, total = 0, {}, {}, 0

        for k, v in pairs(Translations) do
            total += 1
            keys[total], texts[total] = k, v
        end

        local function translateIndex(i)
            local text = texts[i]
            if not text then return end

            task.spawn(function()
                local ok, res = pcall(function()
                    return game:HttpGet(
                        "https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl="
                        .. lang .. "&dt=t&q=" .. HttpService:UrlEncode(text)
                    )
                end)

                if ok and res then
                    local data = HttpService:JSONDecode(res)
                    local translated = ""

                    if data and data[1] then
                        for _, part in ipairs(data[1]) do
                            translated ..= part[1] or ""
                        end
                    end

                    if translated ~= "" then
                        Translations[keys[i]] = translated:match("^%s*(.-)%s*$")
                    end
                end

                completed += 1
            end)
        end

        for i = 1, total do
            translateIndex(i)
        end

        repeat task.wait() until completed >= total
    end
end)

-- [ ======== Use of translated texts ======== ] --

print(Translations.Apple)
print(Translations.Hi)
print(Translations.Test)
print(Translations.Credits)

Features & Information

======================= 🌐 Universal script translator 🌐 Hello script devs! :D Today I'm sharing my universal automatic script translation code. I use it in all my major projects, and today I decided to make it public so that everyone can use it too. This code detects the player's language and automatically translates the text in a table. All you need to do is set your texts to ENGLISH in the "Translations" table. After that, simply use it in all text definitions in your script.
#Translation#Language#Universal#Google

Community Comments (6)

2kr3kn2kr3knApr 27, 2026

Is it better to make a single request instead of four? For instance, by concatenating them using a separator character—say, "#": n = "text1" n2 = "test" s = n .. "#" .. n2 This allows you to bundle the requests; the processing thread splits into sub-threads, making the operation faster—much faster than executing individual requests.

Replying to @2kr3kn
2kr3kn2kr3knApr 27, 2026

Google translates slowly, and making a large number of requests is very costly; you can use other translation services instead.

Replying to @2kr3kn
breezipsettingsbreezipsettingsApr 29, 2026

@2kr3kn Dude, are you talking to your self?

Replying to @breezipsettings
2kr3kn2kr3knApr 29, 2026

@breezipsettings Twitter habit

Replying to @2kr3kn
rexzvyrexzvyOct 9, 2026

@2kr3kn late but why is ts lowk funny 😂

ZONROXZONROXSep 30, 2026

its not working now

More Scripts for Universal Scripts