A game has two kinds of text. The interface is the engine’s own words: the menu buttons, the settings screen, the questions like “Do you want to quit?”. The script is your story: the dialog, the choices, the character names. Monogatari includes the interface in 18 languages; the script is yours to translate.

This page shows how to make a game in one language other than English, and how to offer it in several. It’s all done in your game’s files (js/options.js, js/script.js, js/main.js). The settings and calls used here are described in full in Internationalization.

Each language has a name

The engine knows each language by the name it has in that language, and you write these names in your settings and your script exactly as the engine spells them, accents included:

Language Name to write
Arabic اللغه العربية
Belarusian Беларуская
Bulgarian Български
Chinese (simplified) 简体中文
Chinese (traditional) 繁體中文
Dutch Nederlands
English English
French Français
German Deutsch
Hungarian Magyar
Indonesian Bahasa Indonesia
Japanese 日本語
Korean 한국어
Portuguese Português
Portuguese (Brazil) Português do Brasil
Russian Русский
Spanish Español
Toki Pona toki pona

A game in one language other than English

Set the Language preference near the bottom of js/options.js to your language’s name:

monogatari.preferences({
  'Language': 'Español',

  // …the other preferences stay as they are
});

Open index.html again: the menus, the settings screen and the questions are now in Spanish, and the dates on save cards are written the Spanish way (28 nov 2026, 12:55:47). Your script stays as you wrote it, so write it in Spanish.

NOTE

The Language preference is a starting value. A player who already opened the game keeps the language it had then, because their preferences are stored. That includes you: after changing it, test in a private browser window, which starts with nothing stored.

The page’s language follows too. index.html starts with <html lang="en" …>, and the engine changes it to the language’s code (lang="es" for Spanish), which browsers and screen readers read to know the page’s language. For a language written from right to left, such as Arabic, it also sets dir="rtl": the menus, the quick menu and the text box are mirrored, and each screen’s back button moves to the top right, its arrow pointing right.

A game in several languages

  1. Turn on MultiLanguage in js/options.js:

    'MultiLanguage': true,
  2. Group the script by language in js/script.js. Each language holds its own copy of the labels, with the same label names:

    monogatari.script({
      'English': {
        'Start': [
          'show scene afternoon with fadeIn',
          'y Class ended ten minutes ago.',
          'end',
        ],
      },
      'Español': {
        'Start': [
          'show scene afternoon with fadeIn',
          'y La clase terminó hace diez minutos.',
          'end',
        ],
      },
    });

    Keep the copies in step: when you add a line to one language, add it to the others. A save remembers a label and a line number, so a save made in one language loads at the same place in another only if the lines match.

  3. Pick the starting language with the Language preference in js/options.js. It’s the language the game uses until the player chooses one, and it must be one of the languages of your script.

  4. Open index.html. The first time, the game shows the language selection screen, with a button for each language of your script. The player picks one, and the menus and the story follow. Later, they can change it on the settings screen, which now has a Language choice.

The language selection screen: the title "Selecciona tu idioma", and two buttons, English with a United States flag and Español with a Mexican flag
The language selection screen. Its title changes every few seconds to say "Select your language" in each of the game's languages.

The game screen in Spanish: Yui says "La clase terminó hace diez minutos." and the quick menu reads Atrás, Ocultar, Historial, Auto, Guardar, Cargar, Configuración and Salir
After picking Español: the script's Spanish labels and the Spanish interface.

The selection screen only shows on the first visit. To see it again while you test, open the game in a private browser window. To skip it, set 'LanguageSelectionScreen': false: the game then starts in the Language preference, and players change it on the settings screen.

A few details of the language choice on the settings screen:

  • It changes the interface at once. The line on screen and any choice already showing stay in the old language; the next line comes from the new language’s script.
  • It shows the language the player is using, including one they picked on the selection screen.

Keep each language in its own file

A long script is easier to handle with one file per language. monogatari.script() can be called once for each language:

// js/script.js
monogatari.script({
  'English': {
    'Start': [
      'y Class ended ten minutes ago.',
      'end',
    ],
  },
});
// js/script-es.js
monogatari.script({
  'Español': {
    'Start': [
      'y La última campana sonó hace diez minutos.',
      'end',
    ],
  },
});

Add the new file to index.html, right after the line that loads js/script.js:

<script src="./js/script.js"></script>
<script src="./js/script-es.js"></script>

Each call adds whole languages. Calling monogatari.script() twice for the same language replaces the first call’s labels for that language, so keep all of a language’s labels in one call.

Text outside the script: translation keys

Some text isn’t inside a language’s script: character names, the labels of buttons you add, a word you repeat in every language. For these, write a translation key, _(KeyName), and give the key a text in each language with monogatari.translation():

// js/script.js, above monogatari.script()
monogatari.translation('English', {
  'YuiName': 'Yui',
  'Greeting': 'Hi there',
});

monogatari.translation('Español', {
  'YuiName': 'Yui',
  'Greeting': 'Hola',
});

monogatari.characters({
  'y': {
    name: '_(YuiName)',
    color: '#5bcaff',
  },
});

_(Greeting) then works in any line, in either language’s script: 'y _(Greeting). Class ended ten minutes ago.' shows “Hi there. Class ended ten minutes ago.” in English. Keys work in dialog, in choice texts and in character names. A key with no text in the player’s language stays on screen as written, _(Greeting), so a missing translation shows up when you play.

The labels of menu buttons you add are keys too, written without _( ) (see Add a button).

Change the engine’s words

To use your own word for one of the engine’s texts, give its key a new text. This renames the Start button in both languages:

monogatari.translation('English', {
  'Start': 'New Game',
});

monogatari.translation('Español', {
  'Start': 'Nueva partida',
});

The keys and their English texts are in the engine’s English translation file. Put these calls above $_ready in js/main.js, or in js/script.js.

A language the engine doesn’t include

For a language that isn’t one of the 18, the engine needs two things from you:

  • The interface texts. Every key the engine uses, translated. Starting from a copy of the English texts means no key is ever missing, even before you’ve translated them all:

    monogatari.translation('Italiano', {
      ...monogatari.translation('English'),
      'Start': 'Inizia',
      'Load': 'Carica',
    
      // …and the rest of the keys
    });
  • What the engine should know about the language, for a game in several languages: its language code (for the dates on save cards) and the flag or icon the selection screen shows.

    monogatari.languageMetadata('Italiano', {
      code: 'it',
      icon: '🇮🇹',
    });

    Without it, a game with MultiLanguage on shows an error dialog, “Metadata for language “Italiano” could not be found”, and the selection screen leaves the language out.

Then use 'Italiano' as a language in your script like any other. Translations explains how to send a finished translation to the engine, so everyone who uses Monogatari gets it.

Things to check

  • Every label in every language. Play each language through: a label missing from one language only shows up when a player reaches it.
  • Pictures with words in them. A sign or a letter drawn into an image isn’t translated. Make one image per language and show the right one in each language’s script, or keep the words in the dialog.
  • Save names. Players name their own saves; the date the save screen suggests is written for the player’s language.