+1 vote

Hello community :)

I am currently facing following problem: My team and i had the plan to make our game available in multiple languages. I read all the official docs on this topic and understood that the simplest way to implement this is using the global TranslationServer provided by the engine itself.
Now i am very much aware of how to use this in a script, for example on a label:
label.set_text(tr("SAMPLE_TEXT")).

However, I thought it would be a lot of unnecessary work if I had to handle this on every node, that contains a text, in a script.
But setting the text in the godot editor sadly doesn't result in the engine translating the text, but just displaying tr("SAMPLE_TEXT").

Is there any workaround to this?

in Engine by (39 points)

1 Answer

+1 vote

You don't have to use set_text to input translations.

Objects in general have the ability to translate messages from a Translation.
This can be turned off with set_message_translation(), but by default this is on.

Your Label simply needs it's text set to your translation text.
e.g. : Translation key: "HELLO WORLD!", Hello World
Label's Text set in editor: HELLO WORLD
Label's text when the scene is run: Hello World

Answer based off of 3.2

by (65 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.