Commit 33371662 authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

WIP: i18nScanner

parent c8aafe4f
......@@ -4,4 +4,4 @@
"title": "Grin global application"
}
}
}
\ No newline at end of file
}
{
"action": {
"logout": "Logout",
"submit": "Submit"
"label": {
"loadingData": null
}
}
......@@ -7,6 +7,7 @@
"build": "yarn run i18nGenerate && tsc",
"i18nGenerate": "gg-i18n --moduleName=client",
"i18nFindDuplicate": "gg-i18n-dd",
"i18nScan": "lerna run i18n:i18nscan -- '../**/src/**/*.tsx' --defaultNs=client --ns=\"[client, common]\"",
"test": "jest"
},
"dependencies": {
......
const fs = require('fs');
const chalk = require('chalk');
const minimist = require('minimist');
const args = minimist(process.argv.slice(2));
module.exports = {
options: {
......@@ -20,14 +23,13 @@ module.exports = {
// },
lngs: ['en'],
ns: [
'translations',
'common',
...args.ns.replace(/[\[\]]/gi, '').split(', ')
],
defaultNs: 'translations',
defaultNs: args.defaultNs || 'translations',
defaultValue: null, // '__STRING_NOT_TRANSLATED__',
resource: {
loadPath: 'locales/{{lng}}/{{ns}}.json',
savePath: 'locales/{{lng}}/{{ns}}.json'
loadPath: `${process.env.INIT_CWD}/locales/{{lng}}/{{ns}}.json`,
savePath: `${process.env.INIT_CWD}/locales/{{lng}}/{{ns}}.json`
},
nsSeparator: ':', // namespace separator
keySeparator: '.', // key separator
......
......@@ -5,7 +5,8 @@
"scripts": {
"setup": "yarn run build",
"clean": "rimraf lib",
"build": "tsc && lerna link"
"build": "tsc && lerna link",
"i18n:i18nscan": "i18next-scanner --config i18next-scanner.config.js"
},
"bin": {
"gg-i18n": "lib/tools/generateI18n.js",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment