How can I draw Localized Text to the Screen / HUD ? Slate doesn't seem to support Localization based on use of .ToString()
Dear Friends at Epic,
I am basing my analysis on Epic's article on Localization stating that we should never convert FText to FString.
So if my conclusions are off base, well that is the information I am going on.
I am confused, it would seem that STextBlock and SRichText both are converting FText to FString any time they are actually displaying the text.
STextBlock does not even use FText at all as its base type,
The fundamental stored data is an FString!!!
and in SRichText::SetText(), the very first line is
I am under the impression from your article that we should never be converting FText to String if we want to keep the localization
So how is Localization supported at all currently in terms of drawing it on the HUD using Slate?
How do I draw Localized text to the screen?
The issue with converting FText to FString only affects localisation if the culture is changed while the program is running (FText internally just stores an FString and an ID for the active culture - it will then automatically update the display string if the culture is changed).
This means that it's okay to convert FText to FString for rendering purposes, as the text in the string will still be localised.
You are also correct in stating that we have some Slate widgets still storing text as FString rather than FText, these will still be localised, but they won't automatically update their display string when you change the culture (which is why you have to restart the editor after changing the display language) - we're aware of these, and know that they need to be changed to use FText.
answered Jun 20 '14 at 09:30 AM
Jamie Dale STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here