babel-plugin-secullum-i18n
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -14,3 +14,3 @@ let expressions = null; | ||
if ( | ||
node.callee.name === state.opts.translateFunction && | ||
node.callee.name === state.opts.translateFunctionName && | ||
node.arguments[0].type === "StringLiteral" && | ||
@@ -20,3 +20,3 @@ !expressions.includes(node.arguments[0].value) | ||
throw path.buildCodeFrameError( | ||
`Untranslated word: ${node.arguments[0].value}` | ||
`Expression not found: ${node.arguments[0].value}` | ||
); | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "babel-plugin-secullum-i18n", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "babel plugin to check if a word exist in the translate file", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# babel-plugin-secullum-i18n | ||
![npm](https://img.shields.io/npm/v/babel-plugin-secullum-i18n.svg) | ||
![npm](https://img.shields.io/npm/l/babel-plugin-secullum-i18n.svg) | ||
## Install | ||
```sh | ||
yarn add babel-plugin-secullum-i18n --dev | ||
``` | ||
## Usage | ||
### Via [`webpack config`](https://webpack.js.org/loaders/babel-loader/) | ||
```js | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: "babel-loader", | ||
options: { | ||
plugins: [ | ||
[ | ||
"babel-plugin-secullum-i18n", | ||
{ | ||
expressionsPath: "./sec-i18n.config.json", | ||
translateFunction: "traduzir", | ||
}, | ||
], | ||
], | ||
}, | ||
}, | ||
}, | ||
]; | ||
} | ||
``` | ||
### Via `babel.config.js` | ||
```js | ||
module.exports = (api) => ({ | ||
plugins: [ | ||
[ | ||
"babel-plugin-secullum-i18n", | ||
{ | ||
expressionsPath: "./sec-i18n.config.json", | ||
translateFunction: "translate", | ||
}, | ||
], | ||
], | ||
}); | ||
``` | ||
### Via `config-overrides.js` | ||
```js | ||
module.exports = function override(config, env) { | ||
config.module.rules[2].oneOf.forEach((rule) => { | ||
if (rule.test instanceof RegExp && rule.test.test(".js")) { | ||
rule.options.plugins.push([ | ||
"babel-plugin-secullum-i18n", | ||
{ | ||
expressionsPath: "./sec-i18n.config.json", | ||
translateFunction: "translate", | ||
}, | ||
]); | ||
} | ||
}); | ||
return config; | ||
}; | ||
``` | ||
## Options | ||
- `expressionsPath`: string | ||
- Path to expressions file. | ||
- `translateFunction`: string | ||
- Name of translate function used on project. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2648
83