diff --git a/frontend/gulpfile.ts b/frontend/gulpfile.ts index 5ad80e56..ddb87fca 100644 --- a/frontend/gulpfile.ts +++ b/frontend/gulpfile.ts @@ -30,8 +30,6 @@ import { argv } from 'yargs'; import { JSDOM, VirtualConsole } from 'jsdom'; import * as through2 from 'through2'; import chalk from 'chalk'; -import { gulp as i18nextParser } from 'i18next-parser'; -import HbsI18nLexer from 'handlebars-i18next-parser'; type LibraryProps = { @@ -96,7 +94,6 @@ const sourceDir = `src`, hbsGlobal = 'Handlebars', i18nModuleTail = 'dist/umd/i18next', i18nModule = `i18next/${i18nModuleTail}`, - i18nDir = `${sourceDir}/i18n`, styleDir = `${sourceDir}/style`, mainStylesheet = `${styleDir}/main.sass`, styleSourceGlob = `${styleDir}/*.sass`, @@ -291,18 +288,6 @@ function reportBundleError(errorObj) { log.error(chalk.red(errorObj.message)); } -export function i18nParse() { - return src(`${sourceDir}/**`) - .pipe(new i18nextParser({ - locales: ['en', 'fr'], - output: `${i18nDir}/$LOCALE/$NAMESPACE.json`, - lexers: { - hbs: [HbsI18nLexer], - }, - })) - .pipe(dest('.')); -} - function jsBundle() { return tsModules().bundle() .on('error', reportBundleError) @@ -504,8 +489,6 @@ export const watch = series(fullStatic, function watch(done) { retest(reloadPr(specRunner.render)) ); - // i18nParse(); - exitController.once('signal', () => { [ tsModules(), tsTestModules(), reporterModules(), styleWatch, diff --git a/frontend/i18next-parser.config.mjs b/frontend/i18next-parser.config.mjs new file mode 100644 index 00000000..16285c62 --- /dev/null +++ b/frontend/i18next-parser.config.mjs @@ -0,0 +1,13 @@ +import HbsI18nLexer from 'handlebars-i18next-parser'; + +const sourceDir = 'src'; +const i18nDir = `${sourceDir}/i18n`; + +export default { + input: [`${sourceDir}/**/*.{t,hb}s`, `!${sourceDir}/**/*-te{mplate,st}.ts`], + output: `${i18nDir}/$LOCALE/$NAMESPACE.json`, + locales: ['en', 'fr'], + lexers: { + hbs: [HbsI18nLexer], + }, +}; diff --git a/package.json b/package.json index 05b30135..ac1da4f1 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "watch-front": "yarn gulp watch --port 8000 --config ../config.json", "watch-front-notest": "yarn gulp watchNoTest --port 8000 --config ../config.json", "start": "yarn watch-front & yarn serve-back & yarn watch-back", + "localize": "yarn front yarn i18next -c i18next-parser.config.mjs", "dist": "yarn gulp dist", "dist-p": "yarn dist --production --config ../config.json", "collectstatic-p": "yarn django collectstatic -v 0 --settings production --pythonpath ..",