babel-plugin-secullum-i18n
Install
yarn add babel-plugin-secullum-i18n --dev
Usage
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
module.exports = (api) => ({
plugins: [
[
"babel-plugin-secullum-i18n",
{
expressionsPath: "./sec-i18n.config.json",
translateFunction: "translate",
},
],
],
});
Via config-overrides.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.