Sha256: e369a2dffc76e898ab30b0acd68faf892be2bf9db8ff29b86fc1c49c676a8df5

Contents?: true

Size: 1.21 KB

Versions: 37

Compression:

Stored size: 1.21 KB

Contents

# 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.

:-1: Examples of **incorrect** code for this check:

```liquid
{% comment %}locales/en.default.json{% endcomment %}
{
  "greetings": "Hello, world!",
  "general": {
    "close": "Close"
  }
}

{% comment %}templates/index.liquid{% endcomment %}
{{ "notfound" | t }}
```

:+1: Examples of **correct** code for this check:

```liquid
{% comment %}locales/en.default.json{% endcomment %}
{
  "greetings": "Hello, world!",
  "general": {
    "close": "Close"
  }
}

{% comment %}templates/index.liquid{% endcomment %}
{{ "greetings" | t }}
{{ "general.close" | t }}
```

## Check Options

The default configuration for this check is the following:

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

- [Rule Source][codesource]
- [Documentation Source][docsource]

[codesource]: /lib/theme_check/checks/translation_key_exists.rb
[docsource]: /docs/checks/translation_key_exists.md

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
theme-check-1.1.0 docs/checks/translation_key_exists.md
theme-check-1.0.0 docs/checks/translation_key_exists.md
theme-check-0.10.2 docs/checks/translation_key_exists.md
theme-check-0.10.1 docs/checks/translation_key_exists.md
theme-check-0.10.0 docs/checks/translation_key_exists.md
theme-check-0.9.1 docs/checks/translation_key_exists.md
theme-check-0.9.0 docs/checks/translation_key_exists.md
theme-check-0.8.3 docs/checks/translation_key_exists.md
theme-check-0.8.2 docs/checks/translation_key_exists.md
theme-check-0.8.1 docs/checks/translation_key_exists.md
theme-check-0.8.0 docs/checks/translation_key_exists.md
theme-check-0.7.3 docs/checks/translation_key_exists.md
theme-check-0.7.2 docs/checks/translation_key_exists.md
theme-check-0.7.1 docs/checks/translation_key_exists.md
theme-check-0.7.0 docs/checks/translation_key_exists.md
theme-check-0.6.0 docs/checks/translation_key_exists.md
theme-check-0.5.0 docs/checks/translation_key_exists.md