0.9.1 • Published 3 years ago
i18next-scanner-webpack v0.9.1
i18next-scanner-webpack
This is a simple i18n-scanner webpack-plugin. Based on this package: i18next-parser.
Example webpack.config.js
const path = require('path');
const i18nextWebpackPlugin = require('i18next-scanner-webpack');
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, './src/index.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
plugins: [
new i18nextWebpackPlugin({
// src defaults to ./src
// dest defaults to ./ (project root folder)
// default ['.js', '.jsx', '.vue']
extensions: ['.js', '.jsx']
// See options at https://github.com/i18next/i18next-parser#options
options: {
lexers: {
js: [{
lexer: 'JavascriptLexer',
// default ['t']
functions: ['t', '$t', 'i18next.t', 'i18n.t'],
}]
},
locales: ['en', 'de'],
// defaults to locales/$LOCALE/$NAMESPACE.json
output: '$LOCALE/$NAMESPACE.json'
}
})
]
};
Minimal setup:
const path = require('path');
const i18nextWebpackPlugin = require('i18next-scanner-webpack');
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, './src/index.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
plugins: [
new i18nextWebpackPlugin({
options: {
locales: ['en', 'de']
}
})
]
};
Faster dev loops:
If async
option is true
, the plugin will not wait for i18next-scanner
to finish before reporting back to webpack. Useful in large projects or when using an expensive transform
.
const path = require('path');
const i18nextWebpackPlugin = require('i18next-scanner-webpack');
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, './src/index.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
plugins: [
new i18nextWebpackPlugin({
options: {
locales: ['en', 'de']
},
async: true
})
]
};
Name | Description | default | Optional |
---|---|---|---|
src | source path of files with i18next translations | ./src | yes |
dest | destination of translation files | ./locales | yes |
options | all options | yes | |
async | If true, immediately report back to webpack | false | yes |
Available options: here
0.9.1
3 years ago
0.9.0
3 years ago
0.8.3
3 years ago
0.8.2
4 years ago
0.8.1
4 years ago
0.8.0
4 years ago
0.7.1
4 years ago
0.7.0
4 years ago
0.6.0
4 years ago
0.5.1
5 years ago
0.5.0
5 years ago
0.4.5
5 years ago
0.4.4
5 years ago
0.4.3
5 years ago
0.4.2
6 years ago
0.4.0
6 years ago
0.3.0
6 years ago
0.2.5
6 years ago
0.2.4
6 years ago
0.2.3
6 years ago
0.2.2
6 years ago
0.2.1
6 years ago
0.2.0
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago