Translation gui
Key RequiredUniversal

Translation gui

Universal Scriptvavonodvavonod 28 views 131 executesUpdated Aug 14, 2026
Unrated
00
Lua Script•192 lines (6689 chars)
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
local lp = Players.LocalPlayer
local playerGui = lp:WaitForChild("PlayerGui")

local languages = {
    ["ru"] = "Русский",
    ["uk"] = "Українська",
    ["en"] = "English",
    ["es"] = "Español",
    ["de"] = "Deutsch",
    ["fr"] = "Français"
}
local currentLang = "ru"
local isTranslating = false
local translatedCount = 0
local isMinimized = false

-- Создаем GUI
local screenGui = Instance.new("ScreenGui", playerGui)
screenGui.Name = "FoldableTranslatorGui"
screenGui.ResetOnSpawn = false

local frame = Instance.new("Frame", screenGui)
frame.Size = UDim2.new(0, 260, 0, 220)
frame.Position = UDim2.new(0.05, 0, 0.3, 0)
frame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
frame.Active = true
frame.Draggable = true
Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 10)

local title = Instance.new("TextLabel", frame)
title.Size = UDim2.new(0, 200, 0, 35)
title.Position = UDim2.new(0, 10, 0, 0)
title.Text = "Переводчик интерфейса"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.BackgroundTransparency = 1
title.Font = Enum.Font.GothamBold
title.TextSize = 12
title.TextXAlignment = Enum.TextXAlignment.Left

-- Кнопка-стрелочка для сворачивания (шторка)
local foldBtn = Instance.new("TextButton", frame)
foldBtn.Size = UDim2.new(0, 30, 0, 30)
foldBtn.Position = UDim2.new(1, -35, 0, 3)
foldBtn.Text = "▲"
foldBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
foldBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
foldBtn.Font = Enum.Font.GothamBold
foldBtn.TextSize = 12
Instance.new("UICorner", foldBtn).CornerRadius = UDim.new(0, 6)

-- Элементы внутри окна
local toggleBtn = Instance.new("TextButton", frame)
toggleBtn.Size = UDim2.new(0.9, 0, 0, 40)
toggleBtn.Position = UDim2.new(0.05, 0, 0.16, 0)
toggleBtn.Text = "Авто-перевод: ВЫКЛ"
toggleBtn.BackgroundColor3 = Color3.fromRGB(150, 40, 40)
toggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleBtn.Font = Enum.Font.GothamBold
toggleBtn.TextSize = 12
Instance.new("UICorner", toggleBtn).CornerRadius = UDim.new(0, 6)

local langBtn = Instance.new("TextButton", frame)
langBtn.Size = UDim2.new(0.9, 0, 0, 35)
langBtn.Position = UDim2.new(0.05, 0, 0.38, 0)
langBtn.Text = "Язык: Русский (Нажми)"
langBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 70)
langBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
langBtn.Font = Enum.Font.Gotham
langBtn.TextSize = 11
Instance.new("UICorner", langBtn).CornerRadius = UDim.new(0, 6)

local infoText = Instance.new("TextLabel", frame)
infoText.Size = UDim2.new(0.9, 0, 0, 40)
infoText.Position = UDim2.new(0.05, 0, 0.62, 0)
infoText.Text = "Статус: Ожидание | Переведено: 0"
infoText.TextColor3 = Color3.fromRGB(180, 180, 180)
infoText.BackgroundTransparency = 1
infoText.Font = Enum.Font.Gotham
infoText.TextSize = 10
infoText.TextWrapped = true

-- Логика сворачивания в шторку
foldBtn.MouseButton1Click:Connect(function()
    isMinimized = not isMinimized
    if isMinimized then
        foldBtn.Text = "▼"
        toggleBtn.Visible = false
        langBtn.Visible = false
        infoText.Visible = false
        frame.Size = UDim2.new(0, 260, 0, 40) -- Сжимаем окно в узкую полоску
    else
        foldBtn.Text = "▲"
        frame.Size = UDim2.new(0, 260, 0, 220) -- Возвращаем полный размер
        toggleBtn.Visible = true
        langBtn.Visible = true
        infoText.Visible = true
    end
end)

local function translateText(text)
    if not text or text == "" or #text > 150 then return text end
    if text:match("^[%d%p%s]+$") then return text end
    
    local url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=" .. currentLang .. "&dt=t&q=" .. HttpService:UrlEncode(text)
    
    local success, response = pcall(function()
        return game:HttpGet(url)
    end)
    
    if success and response then
        local data = HttpService:JSONDecode(response)
        if data and data[1] and data[1][1] and data[1][1][1] then
            return data[1][1][1]
        end
    end
    return text
end

local function processGuiItem(gui)
    if (gui:IsA("TextLabel") or gui:IsA("TextButton") or gui:IsA("TextBox")) then
        local original = gui.Text
        if original ~= "" and not gui:GetAttribute("Translated_" .. currentLang) then
            gui:SetAttribute("Translated_" .. currentLang, true)
            
            task.spawn(function()
                local translated = translateText(original)
                if gui.Text == original then
                    gui.Text = translated
                    translatedCount = translatedCount + 1
                    infoText.Text = "Статус: Работает ⚡ | Переведено: " .. translatedCount
                end
            end)
        end
        
        if not gui:GetAttribute("FoldConnected") then
            gui:SetAttribute("FoldConnected", true)
            gui:GetPropertyChangedSignal("Text"):Connect(function()
                if isTranslating then
                    local newText = gui.Text
                    task.spawn(function()
                        local trans = translateText(newText)
                        if gui.Text == newText and gui.Text ~= trans then
                            gui.Text = trans
                        end
                    end)
                end
            end)
        end
    end
end

task.spawn(function()
    while true do
        if isTranslating then
            for _, gui in ipairs(playerGui:GetDescendants()) do
                if not isTranslating then break end
                processGuiItem(gui)
            end
        end
        task.wait(0.5)
    end
end)

toggleBtn.MouseButton1Click:Connect(function()
    isTranslating = not isTranslating
    if isTranslating then
        toggleBtn.Text = "Авто-перевод: ВКЛ"
        toggleBtn.BackgroundColor3 = Color3.fromRGB(40, 150, 40)
        infoText.Text = "Статус: Активен | Переведено: " .. translatedCount
    else
        toggleBtn.Text = "Авто-перевод: ВЫКЛ"
        toggleBtn.BackgroundColor3 = Color3.fromRGB(150, 40, 40)
        infoText.Text = "Статус: Выключен | Переведено: " .. translatedCount
    end
end)

local langKeys = {"ru", "uk", "en", "es", "de", "fr"}
local langIndex = 1
langBtn.MouseButton1Click:Connect(function()
    langIndex = langIndex + 1
    if langIndex > #langKeys then langIndex = 1 end
    currentLang = langKeys[langIndex]
    langBtn.Text = "Язык: " .. languages[currentLang] .. " (Нажми)"
    
    for _, gui in ipairs(playerGui:GetDescendants()) do
        if gui:IsA("TextLabel") or gui:IsA("TextButton") or gui:IsA("TextBox") then
            gui:SetAttribute("Translated_" .. currentLang, nil)
        end
    end
end)

Features & Information

Translation gui

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts