This page covers what you need to know to use the internal localisation system built into Yarn Spinner. This supports both the localisation of the text, so the lines themselves, and your assets needed for them.
Watch a video where Yarn Spinner developer Jon Manning walks you through using the Built-In Localisation System:
When you want to prepare a Yarn Project for an additional language, you add a new Localisation in the Yarn Project.
Localisations are how you tell Yarn Spinner where to find the localised lines, and the localised line assets, for a given language.
To create a new Localisation, open the Localisations list in the Yarn Project's Inspector, and click the + button.
The localisation settings for a project. The base language is English, and two localisations have been set up: one for English, and one for Russian.
Localisations have the following properties:
Your project always includes at least one localisation, which is for the base language.
After you've set up a localisation, you can translate your dialogue into that localisation's language. To do this, you generate a strings file.
You don't need to create a strings file for your base localisation, because Yarn Spinner creates that for you by reading your source Yarn scripts. Any localisation whose language ID is the same as your base language will be marked as 'Automatically included'.
To create a strings file, select a Yarn Project, and click the "Export Strings and Metadata as CSV" button. Unity will ask where you want to save the strings file (the metadata file will have the same name as the strings file, but with a "-metadata" appended to it).
A passage of Yarn script, next to the strings file for those lines.
A strings file has the following structure:
Once you've exported a strings file, you can translate it into another language: for each row in the database, change the
languagecolumn to the new language you're translating into, and the
textcolumn to the translated text of the line.
textcolumns should be modified by the translator. Don't modify the others; in particular, if you modify the value in the
idcolumn, Yarn Spinner won't be able to link the translated line to the original version.
The metadata file contains the
lineNumbercolumns (which have the same values as in the strings file). Additionally, it contains a
metadatacolumn with all the metadata of a line. Only lines that contain metadata will be present in this file. For more information on metadata, see Tags and Metadata.
You can also provide the metadata file to the translator to give them more context and improve localisation accuracy.
Once you have a strings file that's been translated into your target language, you can add it to your Localisation. To do this, drag and drop the translated strings file into the Strings File property of your localisation, and click Apply.
It's possible to update a strings file after you've made changes to your source scripts. For example, you might have added or removed lines, or made changes to the text.
To update a strings file, click the Update Existing Strings Files button at the bottom of the Inspector.
Yarn Spinner will update every strings file that's been added to the Localisations list: new lines will be added, removed lines will be deleted, and lines whose original text has changed since the last time the file was updated will have the text "NEEDS UPDATE" added to the end. This allows you to more easily find which lines need an updated translation.
Localised line assets are assets that are associated with a particular line, in a particular localisation. The most common example of this is voice-over lines, which are audio assets that are associated with each line.
Line Providers are responsible for fetching the appropriate assets for a given line and language. For example, the Audio Line Provider fetches audio clips, and provides them to voice-over dialogue views.
The specific localised line, and localised line assets, that a line provider fetches depends on which language they have been configured to fetch.
The Text Line Provider has a single language option, which controls which language the line will appear in.
The Audio Line Provider has two language options: the language of the text, and the language of the audio files that are retrieved. This means that you can configure it to provide text in one language, and audio in another.
If a line provider is asked to retrieve content for a language that it doesn't have any assets for, it will retrieve the base language version instead.