x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Slate

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

STextBlock does not even use FText at all as its base type,

The fundamental stored data is an FString!!!

SRichText

and in SRichText::SetText(), the very first line is

 //in RichText
 const FString& InString = InText.ToString();

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?

Question

How do I draw Localized text to the screen?

Thanks!

Rama

Product Version: Not Selected
Tags:
more ▼

asked Jun 20 '14 at 01:05 AM in C++ Programming

avatar image

Rama
10.6k 446 345 1088

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jun 20 '14 at 09:30 AM

avatar image

Jamie Dale STAFF
7.4k 176 66 304

avatar image Rama Jun 20 '14 at 08:26 PM

Thank You Jamie!

Rama

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question