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: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.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.
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.,...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"| audioIn 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.