1.0.0 • Published 9 years ago
eslint-plugin-translations v1.0.0
eslint-plugin-translations
Eslint plugin to deal with boring translations/locales.
Installation
Install ESLint either locally or globally.
$ npm install eslint-plugin-translations
Configuration
Add plugins
and rules
section in your eslint configuration:
{
"plugins": [
"translations"
],
"rules": {
"translations/PLUGIN_NAME": [2, {
"languagePaths": [
"locales/en.json",
"locales/de.js"
],
"functionName": "translate",
"ignoreExtensions": [ ".test.js", ".css" ]
}]
}
}
Plugins
exists
will search for all "translate" calls and see if the first argument (normally your locale) has been defined in your locale files.
en.json
{
"HELLO": "Hello"
}
de.js
module.exports = {
HELLO: 'Hallo'
}
file1.js
const myAwesomei18n = require('myAwesomei18n')
myAwesomei18n.translate('GOOD_BYE {{name}}', {name: 'lobezno'})
This will show that GOOD_BYE {{name}}
is not defined in your locales files.
1.0.0
9 years ago