Localisation and Assets

Every line in a Yarn Script can have an ID, called a line tag. The Dialogue Runner uses the ID to find everything that belongs to the line: its translated text, its voice clip, and any other asset that goes with it.

Rosa: The lamp's been out for days. #line:a1b2c3d
Line 1 #line:a1b2c3d is the line’s ID. The Yarn Spinner Console, ysc, can add one to every line, so you don’t have to write them by hand.
A line with a line tag.

Translated text

Yarn Spinner for Unreal Engine reads translations from your .yarnproject file. Each language you list in it has a strings file, a CSV file with the translated text of every line. When the Yarn Project is imported, the translations are stored in the Yarn Project asset. When a line runs, the Dialogue Runner’s Line Provider looks up its text by its ID, in the current language.

Neither Unreal nor Yarn Spinner translates your lines. They put your lines in a file a translator can work with, and show the right language in the game. You or your translators do the translating.

To get your lines to translators, export them as a CSV file with ysc. Each row has the line’s ID and its text. Translators replace the text with their translation, and you add the translated file to the .yarnproject file:

id,text,...
line:a1b2c3d,Rosa: Die Lampe ist seit Tagen aus.,...
A row from a strings file, translated into German. The other columns are cut short here.

If your game already uses Unreal’s String Tables, a Line Provider can read your lines from a String Table instead. See Localising Your Game.

Voice clips and other assets

Voice clips and other assets are found by the Dialogue Runner’s Asset Provider. The one that comes with the plugin loads the asset named in a tag on the line, like #audio:/Game/Dialogue/Voice/a1b2c3d. See Voice-Over.

flowchart LR
  line["Rosa: The lamp's been out for days.<br>#line:a1b2c3d<br>#audio:/Game/Dialogue/Voice/a1b2c3d"]
  subgraph project["Yarn Project asset, German"]
    direction TB
    strings[("Strings file<br>line:a1b2c3d")]
  end
  subgraph content["Content Browser"]
    direction TB
    audio[("/Game/Dialogue/Voice/<br>a1b2c3d")]
  end
  line -->|"translated text"| strings
  line -->|"voice clip"| audio
How the Line Provider and the Asset Provider find a line’s text and voice clip.

In this section

  • Localising Your Game: adding line tags, exporting lines and adding translations, choosing the language while the game runs, and using Unreal’s String Tables.
  • Line and Asset Providers: how the Line Provider finds each line’s text, how the Asset Provider finds its assets, and how to write your own.
Get started Localising Your Game Adding line tags, exporting lines for translators, adding their translations to the Yarn Project, choosing the language while the game runs, and using Unreal's String Tables.