Localization Tutorial

This tutorial demonstrates how to add language localization to dialogue databases and general UI text. We'll add Spanish language localization to the Dialogue System's Demo Scene.

Step 1. Open the Demo Database (or a copy) in the Dialogue Editor.

Step 2. On the Template tab, expand Dialogue Entries. Click the "+" to add a field to the dialogue entry template. Set the Title to "es" (the code we'll use for Spanish) and set the Type to Localization:

localizationTemplate1.png

Step 2. Expand Quests. Click the "+" button twice to add two fields to the quest template, "Name es" and "Description es":

localizationTemplate2.png

If you need to localize other fields, add a field with the language code at the end, such as "Entry 1 es" for the Spanish-localized version of quest entry 1's text.

Step 3. Select Menu → Apply Template To Assets. This will add the new template fields to existing quests and dialogue entry nodes.

Step 4. On the Conversations tab, click on a node. The Inspector should now show an es field below the regular Dialogue Text field:

localizationEntry1.png

Enter the translation:

localizationEntry2.png

Similarly, you can enter translations for quest fields:

localizationQuest1.png

Step 5. Instead of manually entering the translations in the Dialogue Editor, you may prefer to export the database to a CSV file that you can edit in a spreadsheet program such as Excel or Google Sheets. To do this, on the Database tab expand Export Database, set Format to CSV, and click Export....

localizationExport.png

You can add the translations in a spreadsheet program:

localizationSpreadsheet.png

(Some columns were deleted in the screenshot above for compactness.)

Then import it back into Unity using the CSV import window: Tools → Pixel Crushers → Dialogue System → Import → CSV:

localizationImport.png

Step 6. To test the translation, inspect the Dialogue Manager and set Display Settings → Localization Settings → Language to "es":

localizationLanguage1.png

Then play the scene:

localizationLanguage2.png

There are other ways to set the current language such as in code:

DialogueManager.SetLanguage("es"); // Use Spanish.

For more information on ways to set the current language, see the Localization section.

You'll usually also need to localize UI text that isn't in your dialogue database. For example, say you've set Display Settings → Subtitle Settings → Continue Button to Always. The continue button will appear like this:

localizationUI1.png

Step 7. Translations for general UI elements will come from a Text Table asset. To localize the continue button, create a text table by selecting menu item Asset → Create → Pixel Crushers → Common → Text → Text Table. Then double-click the text table to edit it:

localizationUI2.png

The text table editor starts on the Languages tab. Add an entry for "es":

localizationUI3.png

On the Fields tab, add an entry for "Continue":

localizationUI4.png

Change the language dropdown to es and enter the Spanish translation:

localizationUI5.png

Step 8. Assign the text table to the Dialogue Manager's Display Settings → Localization Settings → Text Table:

localizationUI6.png

Step 9. Then inspect the continue button's Text element, and add a Localize UI component:

localizationUI7.png

Now when you play the continue button will be localized:

localizationUI8.png

I2 Localization Support provides an alternate way to add language localization.


<< Tutorials