GatherText eliminates spaces in translated text

Hi there,

We’re very close to locking down loc for our game and I’m having trouble with localized text that starts with a space (ex: " Is Healed!")

Every time I run GatherText it deletes the spaces in the translated text:

“Source”:
{
“Text”: " Is Healed!"
},
“Translation”:
{
“Text”: “Totalmente Curado!”

Any thoughts?!

Hi Bagelbeard,

This is actually by-design, though done in a terrible way, down-stream where it’s confusing. We’ll work on that.

But that intent is that it’s bad practice to have trailing or preceding whitespace in your translatable strings. This is because not all whitespace characters are visible, it can be incredible difficult for a translator to insert the same whitespace, and inserting the same whitespace may not be ideal because often times you change fonts when displaying localized messages which may treat the whitespace characters differently then the native font.

So lots of problems with having trailing and preceding whitespace. You should instead use proper layout constructs, such as padding to achieve the look you desire in your UI.

If you are concatenating strings together and thus need to have whitespace, don’t do that :slight_smile: you’re probably doing something that’s impossible to localize correctly in some languages. The more safe alternative is to perform an FText::Format() using a pattern string. i.e.

FText::Format(“Hello, {Name}”, “Bagel Beard”) instead of "Hello, " + “Bagel Beard”.

Hey Sarge - Thanks for responding.

Sadly we’re too late in the game to make such a change, so it looks like we’ll just have to put a “-” at the front of the string to create space.