Skip to content

Files

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Latest commit

cdeedfd · Feb 10, 2022

History

History
66 lines (49 loc) · 1.46 KB

no-unknown-locale.md

File metadata and controls

66 lines (49 loc) · 1.46 KB
title description
@intlify/vue-i18n/no-unknown-locale
disallow unknown locale name

@intlify/vue-i18n/no-unknown-locale

disallow unknown locale name

📖 Rule Details

This rule reports the use of unknown locale names.

By default, this rule only commonly known locale names specified in RFC 5646 are allowed. The rule uses the is-language-code package to check if the locale name is compatible with RFC 5646.

<script>
/* eslint @intlify/vue-i18n/no-unknown-locale: "error" */
</script>

<!-- ✓ GOOD -->
<i18n locale="en">
{
  "hello": "Hello!"
}
</i18n>

<!-- ✗ BAD -->
<i18n locale="foo">
{
  "hello": "Foo!"
}
</i18n>

⚙️ Options

{
  "@intlify/vue-i18n/no-unknown-locale": [
    "error",
    {
      "locales": [],
      "disableRFC5646": false
    }
  ]
}
  • locales ... Specify the locale names you want to use specially in an array. The rule excludes the specified name from the check.
  • disableRFC5646 ... If true, only the locale names listed in locales are allowed.

🔍 Implementation