STextBlock does not seem to support Localization

Dear Friends at Epic,

It is a colossal problem for me that STextBlock has as its fundamental data type a FString

private:
	/** The text displayed in this text block */
	TAttribute< FString > Text;

Why is this so?

This means the fundamental Text datatype of Slate does not support Localization!

#RichText

SRichText does have correct fundamental datatype, but it does not have an easy accessor for me to change the FTextBlockStyle during runtime to allow for changing size and color of text dynamically.

#Summary

Shouldn’t STextBlock be FText based???

Rama

Currently the localization support for STextBlock uses a ‘pass-through’ FText attribute to allow both localized and non-localized text to be displayed in the text block. The internal attribute is FString-based, for sure, but the attributes passed as arguments to the widget can be either FText or FString so the user of the widget can use localized text if they want to.

See the definition of SLATE_TEXT_ATTRIBUTE in DeclarativeSyntaxSupport.h to see how this works under the hood.

You’re correct, that should really be using FText so that it will automatically update the display string if the culture is changed, however the widget itself can still display localised text since the FString within the FText will still be localised based on whatever culture was active when the widget was created (assuming you passed in something from a LOCTEXT).

We’re aware that we have some widgets storing text as FString rather than FText, and we know that they need to be changed to use FText in order to take full advantage of our localisation system.

#Thanks Jamie!

Then FText will support an in-game option to change the Language dynamically during runtime!

Great to hear from you!

#:heart:

Rama

Great to know from you and Jamie that as long as I pass in FText it will still come out localized, as long as I am storing my FText elsewhere!

Thanks Tom!

#:heart:

Rama

STextBlock has now been updated to use FText, which means that as of 4.5, STextBlock (and everything that nests it) will properly support live culture updates.

Woohoo!

Thanks for the update Jamie!

#:heart:

Rama