Help with localizing strings that change constantly


I’m wondering how I would go about translating a string that constantly changes.

For example, this code:

local replicatedFirst = script.Parent
local contentProvider = game:GetService('ContentProvider')
local players = game:GetService('Players')
local playerUI = players.LocalPlayer.PlayerGui


local UI ='ScreenGui', playerUI)
UI ='Frame', UI)
UI.Size =,0,2,0)
UI.Position =,0,-1,0)
UI ='TextLabel')
UI.Text = 'Waiting for assets'
UI.Size =,0,0.5,0)
UI.Position =,0,0.5,0)
UI.TextSize = 40
UI.AutoLocalize = true
UI.Visible = true
UI.BackgroundColor3 =,1,1)
UI.TextXAlignment = 'Center'
UI.TextYAlignment = 'Center'

local assetsToPreLoad = {}

for i,v in ipairs(game:GetChildren()) do
    local s,e = pcall(function()
        service = game:GetService(v.Name)
    if s then
        table.insert(assetsToPreLoad, #assetsToPreLoad + 1, service)

local t = {
    [1] = '.';
    [2] = '..';
    [3] = '...';

for i = 1, math.huge do
    UI.Text = 'Waiting for assets'..t[(i % 3) + 1]

The text changes to ‘Waiting for assets.’, ‘…’, ‘…’

The problem is that when translating, it should change to ‘En attente des objets de jeu.’, ‘…’, ‘…’ but it stays in English.

Now, when I make it say ‘Waiting for assets’ and keep the text the same, it translates properly.

Any help?

Have you read Roblox’s complete tutorial on Localization?

Be sure that you enable the translated text in settings

1 Like

Yep. The problem only happens when the string changes constantly. If it stays the same, it will translate as expected.

This may be a bug or just that autolocalization only runs when instancing a GUI element. To manually translate text, take a look at the Translator class. I am using the function Translate(context, string) to localize the string. I’m quite new to Localization myself but this is the best I could do. Refer to the Localization tutorial for more info.

here is an example shown

local LocalizationService = game:GetService("LocalizationService")
local player = game.Players.LocalPlayer
local playerTranslator

local foundPlayerTranslator = pcall(function()
	playerTranslator = LocalizationService:GetTranslatorForPlayerAsync(player)


local t = {'.', '..', '...'}
local msg = 'Waiting for assets'

if foundPlayerTranslator then
    msg = playerTranslator:Translate(game, msg)

for i = 1, math.huge do
    UI.Text = msg .. t[(i % 3) + 1]
1 Like

Yeah, this should work. Thanks so much! I thought the translated string would just archive similarly to how :GetNameFromUserId() would, but guess not haha.