Skip to main content
ejGames is shown in the language chosen in Settings → System → Language. By default it follows Windows. Your theme runs in the language the user picks. You write the texts in Spanish, and a dictionary says how they go in each other language.
The key of each text is the Spanish text itself. If there is no translation, the original is shown. You never need an identifier.

The theme’s dictionary

<theme>/i18n/<lang>.json, an object of “Spanish” → “translation”. English is en.json:
  • Values that change go as {name} (or {0}, {1}…) and the translation can reorder them.
  • The kit (/_sdk/kit/) brings its own dictionary in the SDK. You do not need to repeat its strings.
  • The theme’s name, its description and the labels of its theme.json settings are translated with the same dictionary.

Automatic DOM translation

Outside Spanish, ejGames translates on its own every text your theme paints (text nodes and the title, placeholder, aria-label and alt attributes) as soon as it matches a dictionary key, including what is painted later. That is why a theme written in Spanish only needs its dictionary files: you do not have to wrap every string in ejg.t().
  • A text is translated whole (the text node, without leftover spaces). If you build it from several pieces ("Hola " + name), each piece is translated on its own. If you need to reorder, use ejg.t("Hola {n}", { n }).
  • A theme that writes everything in capitals (like Retro) does not need the capitals in the dictionary: “JUGAR” becomes “PLAY” if “Jugar” exists.
  • An element with data-no-t (and everything inside it) is not translated. Neither are <code>, <pre>, <script>, <style> or <textarea>.

Check that nothing is missing

In the ejGames repository, pnpm i18n:check --wide lists the Spanish texts with no translation, and pnpm check accepts the result or not. For your own theme, copy the pattern of themes/<theme>/i18n/en.json.