> ## Documentation Index
> Fetch the complete documentation index at: https://ej3mplo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Languages

> ejg.t, ejg.lang and the dictionaries: your theme in every language ejGames speaks.

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.

```js theme={null}
ejg.lang        // "es" | "en" | "fr" | "de" | "pt" | "ja" | "zh"
ejg.locale      // "es-ES" | "en-US" | …, for Intl and toLocaleString
ejg.t("Jugar")                                // "Jugar" or "Play"
ejg.t("Descargas ({n})", { n: 3 })            // "Downloads (3)"
ejg.tn(n, "{n} juego", "{n} juegos")          // singular or plural
```

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`:

```json theme={null}
{
  "Jugar": "Play",
  "Descargas ({0})": "Downloads ({0})",
  "Tu biblioteca está vacía": "Your library is empty"
}
```

* 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`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.