use directories for structure
This commit is contained in:
47
i18next-scanner.config.js
Normal file
47
i18next-scanner.config.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
|
||||
module.exports = {
|
||||
input: [
|
||||
'src/**/*.{js,ejs}'
|
||||
],
|
||||
output: './',
|
||||
options: {
|
||||
debug: false,
|
||||
func: {
|
||||
list: ['i18next.t', 'i18n.t', 'this.i18n.tr'],
|
||||
extensions: ['.js', '.ejs']
|
||||
},
|
||||
lngs: ['en', 'it', 'de'],
|
||||
ns: [
|
||||
'translation'
|
||||
],
|
||||
defaultLng: 'en',
|
||||
defaultNs: 'translation',
|
||||
resource: {
|
||||
loadPath: 'i18n/{{lng}}.json',
|
||||
savePath: 'i18n/{{lng}}.json',
|
||||
jsonIndent: 4,
|
||||
lineEnding: '\n'
|
||||
},
|
||||
nsSeparator: false, // namespace separator
|
||||
keySeparator: false, // key separator
|
||||
interpolation: {
|
||||
prefix: '{{',
|
||||
suffix: '}}'
|
||||
},
|
||||
removeUnusedKeys: true
|
||||
},
|
||||
transform: function customTransform(file, enc, done) {
|
||||
const {ext} = path.parse(file.path);
|
||||
const content = fs.readFileSync(file.path, enc);
|
||||
if (ext === '.js' || ext === '.ejs') {
|
||||
let p = this.parser;
|
||||
p.parseFuncFromString(content, function(key) {
|
||||
p.set(key, '⚠ ' + key + ' ⚠');
|
||||
});
|
||||
}
|
||||
done();
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user