In-Experience Text Chat Translations

Support for custom chat systems is needed

This feature has actually been really helpful already. I’ve talked to people speaking languages I don’t know, and it’s proven to be pretty great so far. Not sure how accurate it is, but it’s enough that I don’t have to Google translate everything they’re saying.

Edit: elaborated on a couple things

This is a great addition to TextChatService, but there are 2 reasons why I have not implemented this service into my game yet. The first and biggest reason is a lack of default text channel tabs UI, especially a tab for private messages between 2 players. Another smaller reason is the lack of an ability for the player to dynamically resize the chatting window in-game like the legacy chat. I think once these two features are supported in the new TextChatService, I will definitely start using it.

1 Like

It absolutely is. You cannot offer an engine to developers and limit their customizability abilities like this. If I want to be able to customize the chat however I want, I should be able to. If I want to add a, for example, profile icons to the chat, I should be able to.

LegacyChatService will always be superior to TextChatService in terms of customization and freedom. And it should be.

I’ve turned it on and it doesn’t seem to do anything at all. All the russian text is still russian, polish is still polish, german is still german, turkish is still turkish etc. I don’t see ANY difference with it enabled compared to it being disabled.

Edit: Wait it HAS to be the new chat for it to work? There is like 3 million games that still have the old chat. This doesn’t seem usefull if the older chat doesn’t support it.
image
image

There is no plans to support the old chat as that is no longer updated by Roblox. The game requires to have the new chat for it to work.

Good news! I have played a bit in the LegacyChat, and there is new code for chat translation! I even got it to work (through a kind of sketchy workaround, basically strait up replacing messageObj.Message with the translated version). I’ll look into it deeper to figure out how to properly get it to work

@metatablecatmaid
@Emp_or
@Rick007110
@nvckx
:wink:

EDIT

This is how to get it working

This variable has to be overwritten (since it’s disabled)

It has to be overwritten in these scripts

  • ChatChannels (Server module script)
  • ChatMain (Client module script)
  • ChatChannel (Under ChatMain)
  • MessageLogDisplay (Under ChatMain, optionnal? unsure what this one does)
  • DefaultChatMessage (inside ClientChatModule/MessageCreatorModules

The Speaker module also has the variable, but it does nothing

ChatMain and ChatChannel also listens for a BoolValue under ChatMain
The BoolValue must be named “ChatTranslationEnabled” and have a value of true


(It isn’t on this screenshot but yeah)

And this is the result!
image
(Ignore the custom look I gave to the chat)

It’s highly likely that UserSettings():IsUserFeatureEnabled("UserHandleChatHotKeyWithContextActionService") will be true in the future when chat translations is enabled in the settings (I tested and it was false even with the setting on). The only thing that seems like might be required in the future is the BoolValue, though it is also likely that it will be added eventually

3 Likes

It uses TextFilterTranslatedResult (which has no documentation yet) from TextService:FilterAndTranslateStringAsync().

This is how TextFilterTranslatedResult is used inside the LegacyChat (it’s translations:GetTranslationForLocale(). Locale is “en”, “fr”, … or “en-us”, “fr-ca”, …)
listOfTargetLanguages is a table containing “en”, “fr”, …


And how TextService is used:

Since the LegacyChat uses normal lua scripts inside the Chat tab (not core scripts or anything) this is probably accessible by anyone, which is amaizing :smiley:

@McDmnks, @ketrab2004, @bluebxrrybot Seems like the support is there!

1 Like

Very interesting. It would be nice if Roblox documented that method other than just provide the parameters. Player.LocaleId isn’t just “en” or “fr”, it’s “en-us”. The “en” part is the ISO 639-1 language code. The “us” part is the ISO 3166-1 Alpha 2 country code. I know about that because I had to key all that information into a MySQL database for a web application awhile back.

List of ISO 639 language codes
List of ISO 3166-1 alpha-2 country codes

Now the question becomes what is that array listOfTargetLanguages filled with?

EDIT:

I think figured out the correct process to use this.

  1. Use TextService:FilterAndTranslateStringAsync() to filter the message as normal. This returns a TextFilterTranslatedResult.
  2. Call TextFilterTranslatedResult:GetTranslationForLocale(). This returns a TextFilterResult object.
  3. Finally, use TextFilterResult:GetChatForUserAsync() to get the filtered and translated string on a per user basis.

The language table is a table of locale identifiers such as “en-us” or “fr-fr”.

EDIT:

Well, I implemented it and it doesn’t seem to be working. TextFilterTranslatedResult:GetTranslationForLocale() ALWAYS returns nil which kills it. So I’ve reverted to the non-translated version for now.

The table listOfTargetLanguages provided to FilterAndTranslateStringAsync() is not a table with “en-us” but rather “en” alone. This might be why it isn’t working for you

This is the fonction used in the legacy chat to convert it

function getLanguageCodeFromLocale(localeId)
	-- Get every match of not a "-"
	local codeMatch = string.gmatch(localeId, "[^-]+")()
	if codeMatch then
		return codeMatch
	else
		return "en"
	end
end

image

Using just “en” for GetTranslationForLocale also works, since well, it works…

But in the Speaker module, the full string is used

I actually have a table that was generated by the Roblox Assistant that has all that information in it. I’ll try this and see what it does.

EDIT:

Nope. Tried it both in Studio and in the live game. Still returns nil.

I want to point out that Player.LocaleId returns “en-us” for me so it should take that based on the code given.

EDIT 2:

I played with it a bit and I still cannot get it to work. I have never seen it work with the legacy chat. That makes me wonder if it ever worked.

1 Like

I got it to work in game, in the legacy chat, however, I tried to use TextService alone, and that doesn’t work (I tried a bunch of different things, like using “fr” alone in the table, …, and still nothing)

local TextService = game:GetService("TextService")

task.wait(5) -- The sender must be connected

TextFilterTranslatedResult = TextService:FilterAndTranslateStringAsync(
	"This message is in english",
	79690730, -- My UserId
	{"en-us","fr-ca"},
	Enum.TextFilterContext.PublicChat
)

print(TextFilterTranslatedResult:GetTranslations())
print(TextFilterTranslatedResult:GetTranslationForLocale("fr"):GetNonChatStringForBroadcastAsync())

I am wondering if either it only works in live games (though that didn’t work for you) or maybe there needs to be two players in game with their LocaleId set to “en” and “fr”, as an example

Is there a method to enable automatic activation?

I’ve noticed that when launching Roblox (using the desktop application), the setting for “Automatic Chat Translation” is consistently disabled, while the option to view untranslated messages remains enabled. However, upon enabling automatic translation and subsequently joining another game, the setting remains active. Yet, upon closing and reopening Roblox, the setting reverts to being disabled.

In studio, the setting seems to also be disabled after turning it on.

In my opinion, it would be beneficial if this feature were enabled by default or if user preferences were saved, akin to settings such as volume, graphics, and camera sensitivity for example.

Below, I’ve attached a screen recording illustrating the issue for reference.

1 Like

I have been playing various Roblox games for the past couple of weeks and I have yet to see anything actively translate. Are you guys sure that it’s working? I have encountered players speaking Spanish, Korean, and Japanese and I’m just getting what they are typing without translation.

2 Likes

hmmm the script doesn’t seem to work.

I like this update! Was Spanish removed as a “Chat Translation Language” option? It says Spanish is supported in the post, but I can’t find it listed here.

1 Like

I’ve realized that this feature is a setting on console. That’s great. But what is the use of this feature being on console with no chat, and not being able to see chat on console?

2 Likes

Translation bug report : Chats where someone introduces themselves as Vietnamese are translated as introducing themselves as Korean. I using Korean translation.
화면 캡처 2024-08-17 000745화면 캡처 2024-08-17 000755

Setting not saving issue : Due to the poor translation quality, I am trying to view untranslated text. However, every time I join games, the ‘option to view untranslated messages’ is set to off.

New feature suggest : It seems that my ability to translate from English to Korean is better than the Roblox automatic translator. Therefore, I would like to either translate only non-English languages into Korean or convert non-Korean languages into English. Please create a selective auto-translation option.

2 Likes

Uhhh

image
The ‘?’ is the original message
The person speaks Japanese

1 Like

I have had this issue as well. I turned on Automatic Chat Translation, but the next time I played the same game, it was off again. The ChatTranslationEnabled property also kept turning itself off even after I published my game with the property turned on several times. I hope this is fixed by the time TextChatService is required in every game in April.