Anyone know how to setup text localization with Button icons within the text?

We have localization within our game for PC.

We currently have something like…

“Press the [Crtl] button to crouch”

But we want to add controller support and cannot figure out how to replace the Ctrl with an icon representing a controller button.

Similar to: []

We could break up the sentence into peices, but the sentence structure would not be the same for each language so the icon would not necessarily be the same place.

Does any one know how this is usually handled, can I add a reference to an icon right in an XML string?

The simplest way, in my opinion, is to use TextMeshPro, the successor of the Text component of Unity.

It’s free since Unity 5.3.4, and downloadable from the Asset Store (Unity 2017.4 or older), or directly from the Package Manager in Unity 2018 and newer.

Then, create a SpriteSheet containing all your buttons and, in your XML file, just put the sprite tag in your text, at the desired place, according to your translation. I believe you will need CDATA to prevent the XML parser from interpreting the sprite tag : CDATA Sections | Microsoft Learn

    <en><![CDATA[Press <sprite name="SpaceButton"> to jump]]</en>
    <fr><![CDATA[Appuyez sur <sprite name="SpaceButton"> pour sauter]]</fr>

How to create the Spritesheet

How to use the <sprite> tag

You could use a horizontal layout group - and split the text up.