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 Project 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 Unity has its own localisation system, built into the Yarn Project. Each language you add to the Yarn Project has a strings file, a CSV file with the translated text of every line. When a line runs, the Dialogue Runner’s Line Provider looks up its text by its ID, in the current language.

Neither Unity 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 from the Yarn Project as a CSV file. 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 Yarn Project:

language,id,text,...
de,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 Unity’s Localization package, Yarn Spinner can put your lines in a String Table Collection instead. See Localising Your Game.

Voice clips and other assets

Voice clips and other assets are found by the line’s ID as well. Each language in the Yarn Project can have an assets folder. A clip called a1b2c3d.wav in the German assets folder belongs to the line tagged #line:a1b2c3d, when the game is in German. See Voice-Over.

flowchart LR
  line["Rosa: The lamp's been out for days.<br>#line:a1b2c3d"]
  subgraph project["Yarn Project, German"]
    direction TB
    strings[("Strings file<br>line:a1b2c3d")]
    audio[("Assets folder<br>a1b2c3d.wav")]
  end
  line -->|"translated text"| strings
  line -->|"voice clip"| audio
How the Line Provider finds a line’s text and voice clip from its ID.

In this section

  • Localising Your Game: adding line tags, exporting and adding translations, choosing the language while the game runs, and using Unity’s Localization package.
  • Line and Asset Providers: how the Line Provider finds each line’s text and 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 Unity's Localization package.