---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/games/doc/en/requirements/2/14.md
  - https://yandex.com/dev/games/doc/ru/requirements/2/14.md
  - https://yandex.com/dev/games/doc/tr/requirements/2/14.md
  - https://yandex.com/dev/games/doc/zh/requirements/2/14.md
  - href: en/requirements/2/14.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/en/llms.txt

# Automatic language detection

<!-- source: en/_includes/script-common.md -->
<!-- source: en/_includes/script/index-js.md -->

<!-- endsource: en/_includes/script/index-js.md -->

<!-- source: en/_includes/script/requirements-js.md -->

<!-- endsource: en/_includes/script/requirements-js.md -->

<!-- source: en/_includes/script/image-modal-js.md -->

<!-- endsource: en/_includes/script/image-modal-js.md -->
<!-- endsource: en/_includes/script-common.md -->

{% note info "Item 2.14 of the Game Requirements" %}

The game includes automatic language detection via SDK.

{% endnote %}



## Integration {#sdk-i18n}

{% note warning %}

Auto-detection via the SDK must:

- Occur during launch, not during gameplay.
- Be implemented in all games, even if they declare only one language or have no text.

{% endnote %}

To determine the user's language, get the [language code](*lang_code) from the [environment.i18n.lang](https://yandex.com/dev/games/doc/en/sdk/sdk-environment.md#structure-i18n) parameter:

```javascript showLineNumbers
const ysdk = (await YaGames.init());
const lang = ysdk.environment.i18n.lang; // 'en', 'ru', ...
```

Then use the `lang` variable when loading game translations.



## Verification method {#verification-method}

### Checking one language {#one-lang}

To make sure the game language is detected automatically:

1. Clear the [browser cache](https://yandex.com/support/common/browsers-settings/cache.html){.external}.
1. Open the game with the [debug panel](https://yandex.com/dev/games/doc/en/console/debug-panel.md):

   <!-- source: en/_includes/requirements/start-debug-panel.md -->
   {% list tabs %}

   - Using the developer console
       1. Open the [Yandex Games console](https://games.yandex.com/console){.external}.
       2. Select the game you need.
       3. In the top left corner, click on **Open with debug panel**.

   - Using the address bar
       1. Open the required game.
       2. Add `&debug-mode=16` to the end of the browser's address bar.

          Example link: `https://yandex.com/games/app/XXXX?debug-mode=16`, where `XXXX` is the unique game ID.

   {% endlist %}
   <!-- endsource: en/_includes/requirements/start-debug-panel.md -->

1. Check that language auto-detection via the SDK works on the first game launch:

    #|
    || **Background** | **Text** | **Value** ||
    || ![Language indicator with green background.](../../_images/debug-panel/i18n-on.svg) | ##I18N is used## | Auto-detection is enabled. ||
    || ![Language indicator with red background.](../../_images/debug-panel/i18n-off.svg) | ##I18N is not used## | Auto-detection is not enabled. ||
    |#

    {% note warning %}

    The 文 indicator color should change to green ![green](../../_images/debug-panel/i18n-on.svg) at startup, not during gameplay. A short interval for loading the language is acceptable: at startup, before the indicator changes from red to green, loading text in another language may be displayed.

    {% endnote %}

#### Examples {#one-lang-examples}

<div class="table-50">

#|
|| **Game** | **Comment** ||
|| ![The player clicks "Play", and only after that the language indicator changes from green to red.](../../_images/requirements/2-14-lang-autodetection/i18n-not-ok.gif) | 🚫 Auto-detection is enabled after the level starts. Such a game will not pass moderation. ||
|| ![The indicator changes color from red to green during loading. The game is in Russian only, the "Loading" text is initially in the correct language.](../../_images/requirements/2-14-lang-autodetection/i18n-ok-1.gif) | ✅ There is a short delay before auto-detection is enabled, the language is initially correct (the game is in RU only). ||
|| ![The indicator changes color from red to green during loading. At the same time, the text "Загружаемся" changes to "Loading", which matches the selected game language - English.](../../_images/requirements/2-14-lang-autodetection/i18n-ok-2.gif) | ✅ There is a short delay before auto-detection is enabled, the text language changes along with the indicator color change (EN language). ||
|#

</div>


### Checking multiple languages {#multi-lang}

Moderation checks game localization for all languages specified on the **Draft** tab in the [Game translated into](https://yandex.com/dev/games/doc/en/console/add-new-game/draft.md#field-languages) field.

Repeat the [basic check](#one-lang) for each declared language. To do this, open the game sequentially in all these languages:

1. On the debug panel, click **SDK mocks ⚒️**.
1. In the dropdown list with the language designation (for example, **En** ![down arrow icon](../../_images/debug-panel/choose-game-lang-arrow.svg)), select the one you need. The game will open in this language in a new browser tab.

{% note info %}

If the game has manual language switching, moderation will only check the implementation for technical and logical errors. To improve player experience, check on your own that you follow the recommendations from [item 6.9](https://yandex.com/dev/games/doc/en/concepts/requirements.md#6-9) of the Game requirements.

{% cut "Example of manual language selection" %}

![Manual language selection menu inside the game.](../../_images/requirements/2-14-lang-autodetection/manual-lang-selection.webp)

{% endcut %}

{% endnote %}

Moderation verdicts:

- ✅ If all declared languages loaded — the game will pass moderation.
- 🚫 If at least one language did not switch (fully or partially) to the one selected on the debug panel — the game will be rejected for lack of translation. At the same time, moderation takes into account exceptions that do not need to be translated (see the [calibration list](https://yandex.com/dev/games/doc/en/requirements/8/2/3.md) for item 8.2.3).
- ✅ It is acceptable if after refreshing the page with the game, auto-detection is absent in cases where the developer has implemented language saving in cache.



## Contact moderation {#forma}

If you believe that language auto-detection works correctly in the game and it was removed from publication or not admitted to it by mistake, please fill out the form below.

The quality control service of moderation will re-check the decision and return the game if it was blocked unjustly.

<div class="cut-button">

{% cut "Open the form" %}

<div style="padding: 15px;
         margin: 10px 0;
         background: #FFFFFF;
         border-radius: 10px;
         border: 1px solid var(--yc-color-line-generic);">
      <iframe height="400"
              width="100%"
              frameborder="0"
              id="moderation-2-14-form"
              src="https://forms.yandex.com/surveys/13487250.5a13659b18018197b1f339b05e2d4dacc05604a6/?answer_choices_52072484=1769421882100&iframe=1">
      </iframe>
</div>

{% endcut %}

</div>

[*lang_code]: The code is specified in ISO 639-1 format. For example, `"tr"` means that the game is currently running in the Turkish interface of Yandex Games. All supported languages are listed on the [{#T}](https://yandex.com/dev/games/doc/en/concepts/languages-and-domains.md) page.