Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 1.13 KB

translation_key_exists.md

File metadata and controls

63 lines (44 loc) · 1.13 KB

Prevent use of undefined translations (TranslationKeyExists)

This check exists to prevent translation errors in themes.

Check Details

This check is aimed at eliminating the use of translations that do not exist.

👎 Examples of incorrect code for this check:

{% # locales/en.default.json %}
{
  "greetings": "Hello, world!",
  "general": {
    "close": "Close"
  }
}

{% # templates/index.liquid %}
{{ "notfound" | t }}

👍 Examples of correct code for this check:

{% # locales/en.default.json %}
{
  "greetings": "Hello, world!",
  "general": {
    "close": "Close"
  }
}

{% # templates/index.liquid %}
{{ "greetings" | t }}
{{ "general.close" | t }}

Check Options

The default configuration for this check is the following:

TranslationKeyExists:
  enabled: true

When Not To Use It

It is not safe to disable this check.

Version

This check has been introduced in Theme Check 0.1.0.

Resources