Advanced: Localization
Translate!
Last updated
Translate!
Last updated
This describes the principle of working with tutorial translations in different languages. The system involves:
The InputStringsScriptableObject object (TSR > TipTextData)
A CSV table with translations (TSR > TipTextData > CSVFile)
The texts from here are embedded in the tutorial steps and can be edited from both locations
To translate, you need to have text hints available in at least one language. To add translations:
Open TSR > TipTextData. This is where all text hints for all scenes and tutorials are stored.
Press "Export current strings to CSV" button.
Edit CSV. Copies of your current strings were created in the "Default" column. Pass them through a translator and insert the translations into the corresponding language columns.
Done. Now, when switching between languages in runtime or edit mode, the strings change according to the translations. The string and its translations are searched by matching text, not tied to specific indices.
Changing the language seamlessly updates all text hints both at runtime and in edit mode.
Change the language via TSR > TipTextData by simply selecting a different value from the dropdown list.
Call TSR > TranslateAllTutorial() method. Use one of the existing languages from the dropdown list for it.
sceneReferences.TranslateAllTutorial(InputStringsScriptableObject.Language.Italian);
Change the language via ATM by simply selecting a different value from the dropdown list.
Call TSR > TranslateAllTutorialByString() method. Specify any language declared in the first row of the CSV file, even one that is not listed in the dropdown menu.
sceneReferences.TranslateAllTutorialByString("Polish");
Open InputStringsScriptableObject.cs
Find "public enum Language" > "AddCustomLanguage = 11" and replace it with your language, f.e. "Romanian = 11"
Open CSV file and fill 11th column (L) with Romanian translations
Done. To create new languages, use the indices of unused columns, f.e. "CustomLanguage = 16"
Open CSV file and fill any empty column with translations
Make sure line 0 in column is named after used language, f.e. "Romanian"
Done. However, calling this language for translation is only possible via TranslateAllTutorialByString("Romanian") method. Link it to a flag button, for example.