In an internationalized application, Japanese characters are not allowed. This rule helps to find out where Japanese characters are.
The following patterns are considered problems:
var str = "日本語";
The following patterns are not considered problems:
var str = "English";
// or
var str = this.getIntlMessage("i18n.key"); // using an i18n tool instead of regular Japanese characters
The rule takes an object option with the following keys:
- In general, we don't check identifiers for l10n/i18n. If you would like to lint them, set
includeIdentifier
astrue
to enforce checking.
"i18n/no-japanese-character": [
"warn",
{
"includeIdentifier": true
}
]
- It's also not common to check comments for l10n/i18n, but you can set
includeComment
astrue
to enforce checking.
"i18n/no-japanese-character": [
"warn",
{
"includeComment": true
}
]
- We exclude from the check the functions specified in the
excludeArgsForFunctions
option.
"i18n/no-japanese-character": [
"warn",
{
"excludeArgsForFunctions": ["i18n", "l10n", "i18n.t"]
}
]