translator:Translate no longer works for strings in a cloud table

Reproduction Steps

1) Retreive a translator using LocalizationService:GetTranslatorForPlayerAsync
2) Call translator:Translate(context, string) on the translator object returned by that method
3) The text won’t get translated, despite correctly-formatted sources strings and translations being available in the cloud table

I’ve been experiencing this issue with Car Crushers 2’s cloud table: [7 NEW CARS] Car Crushers 2 - Roblox

Expected Behavior

When you retreive a translator using LocalizationService:GetTranslatorForPlayerAsync, you should be able to call :Translate on that object to translate strings using the game’s cloud table.

I have multiple uses of this in Car Crushers 2 which worked properly up until recently.

Actual Behavior

The :Translate method does nothing, as if there’s no translation available for specified string (But there is)

Workaround

If I download my entire cloud table and load it as an embedded file under LocalizationService, the :Translate method will properly translate the strings like it should.

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Constantly
Date First Experienced: 2023-02-04 10:02:00 (+01:00)

2 Likes

Thanks for the report! We’ll follow up when we have an update for you.

2 Likes

Hey @Panwellz - thanks for your report! Sorry it’s taken so long to get back to you. We haven’t been able to reproduce this behavior. Are you still running into this issue?

I just tested and can confirm that it’s still happening.

I’m simply using LocalizationService:GetTranslatorForPlayerAsync to get the translator and calling :Translate on this, with the first argument usually being the target textLabel or otherwise game.Workspace.

Let me know if there’s any way I can send the csv table we’re using. We add almost all strings manually, so most of the strings here have an empty “Context” field.

If the team is working on Localization issues then please also take a look at these posts. It’s currently impossible to achieve 100% translation coverage with these issues in place:

Hi @Panwellz thanks for the report! A few questions:

  • Are you observing this behavior in client, studio or both?
  • Which player languages are you observing the behavior with?
  • Are there any messages that appear in the output window/log?
  • Would you mind sharing a code snippet of how you are creating the translator instance and making the translate call?

Thanks!

I’m observing this in studio while testing with the player emulator set as Korean (Locale). When I do this, all strings in the game are translated except those that make use of a translator.

This is tested in a place of the same game that has the cloud table uploaded, and the automatic translations seem to appear for all other strings even if there’s no embedded table, so that part seems to be working.

I haven’t tested on the client recently. And there’s no messages appearing. Here’s simplified snippet of the main code:

-- Services
local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")

-- Player
local Player = Players.LocalPlayer

-- Source Constants
local SourceContainer: Folder = Instance.new("Folder", {
	Name = "TranslationSource";
	Parent = game;
})

function GetTranslator(): Translator?
	-- Store our new translator
	local success, result = pcall(
		LocalizationService.GetTranslatorForPlayerAsync, LocalizationService,
		Player
	)

	if success then
		return result
	else
		return nil
	end
end

function Translate(text: string, source: string?
	): string
	-- Determine our source for the translation
	local sourceObject = Workspace

	if source ~= nil then
		sourceObject = SourceContainer:FindFirstChild(source)

		if sourceObject == nil then
			sourceObject = Instance.new("Folder", {
				Name = source;

				Parent = sourceObject;
			})
		end
	end

	-- Now return our translation
	local translator = GetTranslator()

	return (
		if translator == nil then
			text
			else
			translator:Translate(sourceObject, text)
	)
end

Hi, thanks for the info! I tested out your code, there is an error that appear occurs on this line:

local SourceContainer: Folder = Instance.new("Folder", {
	Name = "TranslationSource";
	Parent = game;
})

(error is: invalid argument #2 to 'new' (Instance expected, got table) )

However after changing that to:

local SourceContainer: Folder = Instance.new("Folder")
SourceContainer.Name = "TranslationSource"
SourceContainer.Parent = game

I unfortunately was not able to reproduce the issue.

Do you still run into this issue after resolving the above error? If so, could you tell me where in the experience I can go to reproduce the failed translate call?

Hey sorry for the delay. The above error is just a mistake I made when compressing a code example to share here. It isn’t there in the actual game.

The issue no longer happens and I’m not sure when exactly it got fixed. The only clue I have is that a formatting issue was causing my cloud table to break. There was an incorrect bracket format in one of the japanese translation entries. Which only became apparent when downloading the entire cloud localization and trying to load it into an embedded table. (Which creates a warning about it)

I fixed this in the main cloud table a couple months ago and that may have solved this. I believe you can find this in csv file I shared with Nightgaladeld earlier (If so the studio csv import should display the line in the warning)

1 Like

Hey @Panwellz, thanks for following up! We’ll go ahead and close out this thread since the issue has been resolved. Please let us know if you run into any more issues in the future.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.