Skip to content

Add a language

Goal: the game offers a second language, and the player can switch to it.

  1. Open the Texts page and the Languages tab. With no languages yet it says “No languages yet. Add the language your story is written in first.”
  2. Click Add a language under the list. A list titled Add language opens: pick your story’s own language by name or code. Its name is filled in, and you can change Name later. The Code cannot change once the language exists.
  3. Choose that language in Source language of the story, above the list. The first time, Unity asks to create a translations file beside the database; click Create. Then add the second language the same way.
  4. Choose Falls back to: the language shown when a text is missing here. A new language falls back to your story’s language and starts empty.
  5. Open the language to set how it is written: Written right to left, Plural forms, Extra font. Voice clips use names the code of its voice clips (see Add a voice to a dialogue).
  6. Fill in the translations on the Story texts and Named texts tabs, or use Fill missing translations…. It fills only empty translations with a machine draft, after you confirm.

You will see: a row with the columns Language, Code, Has and Falls back to. Has shows how much of the story the language has.

On the Intrigue Manager, Active Language is the language the game starts in. Language At Start and Remember The Player’s Choice decide whether the player’s last choice is used. See Intrigue Manager.

To switch while the game runs, call this. Example. Compiled against the package’s runtime assembly; not run in Unity. The signature is from IM.Localisation.cs:

IM.ChangeLanguage("fr");

static void ChangeLanguage(string languageKey) raises IM.onLanguageChanged with the new code. null, an unknown language or a scene with no manager changes nothing, and an unknown language logs one error. With Remember The Player’s Choice on, the code is kept in the player’s preferences. In the editor and in development builds, xx-pseudo shows every text accented and longer, to test layout. It is never remembered.

Put the choice on a button with a Localized Text label.

  • The text stays in the source language: it is missing in the new one, so the fallback shows. Check Has.
  • Nothing happens on a switch: the code is not a language of the game. Codes are compared as written.
  • Arabic or Persian letters look unjoined: TextMesh Pro does not join them by itself. A programmer plugs in a shaping tool through IM.TextShaper.
  • The language is not remembered: Remember The Player’s Choice is off, the default.
  • A code longer than 16 characters cannot be sent as a player’s language in a multiplayer game.

To have Claude do the first translation, see Translate by prompt. Background: Texts and tokens.