Hello! I manage to add Pseudo-localization to my game adding Spanish and English, but the issue is the only I don’t understand is to do the RichTextlabel with BBCode translation, I added as a line, but doesn’t work. For example, I have my CSV like this:
,en,es
Select Level,Select Level,Elegir nivel
Easy,Easy,Fácil
Hard,Hard,Dificil
[center]Thanks to take a time to look at this section and also thanks for playing![/center],[center]Thanks to take a time to look at this section and also thanks for playing![/center],[center]¡Gracias por tomarte un tiempo para mirar esta sección y también gracias por jugar![/center]
The first ones been labels works fine but the last one doesn’t work. How do i make it also translate this part also?
You should be more specific than just “it doesn’t work”. What exactly is wrong? Do you see the English text without BBCode formatting or no text at all? Anyway, the first value in a CSV line is supposed to be a key (a short unique string), not a real text.
Make sure that RichTextLabel > BBCode Enabled is On for the RichTextLabel node in the Inspector.
When I click on pseudolocalization and play the scene, all the labels changes to Spanish except the RichTextLabel. I tried giving all of them using a unique string, but it doesn’t work, it start to work once I use the same text in both lines columns, but I’m not figuring out how to translate a RichTextLabel and include it on my CSV file.
Hey, I encountered the same problem just now! I’ll still post this for future reference.
extends Node
@export var textForTranslation : String
@onready var label : RichTextLabel = self.get_parent()
@onready var originalText
func _ready():
originalText = label.text
translate.call_deferred()
func translate():
label.text = originalText.replace("?", tr(textForTranslation));
func _notification(what):
if what == NOTIFICATION_TRANSLATION_CHANGED:
translate.call_deferred()
Make a new Node as a child of the RichTextLabel and attach this lil script.
In textForTranslation put your key from your CSV file and put an “?” where you want the translated text to be. You can easily change the symbol in translate(). It will auto translate the text and sync with translation changes during play.
Cheers!