2022-02-10 18:20:59 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
const { GettextExtractor, JsExtractors } = require('gettext-extractor');
|
|
|
|
|
|
|
|
const extractor = new GettextExtractor();
|
|
|
|
|
|
|
|
extractor
|
|
|
|
.createJsParser([
|
|
|
|
JsExtractors.callExpression('gettext', {
|
|
|
|
arguments: {
|
|
|
|
text: 0,
|
|
|
|
context: 1,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
JsExtractors.callExpression('gettext_noop', {
|
|
|
|
arguments: {
|
|
|
|
text: 0,
|
|
|
|
context: 1,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
JsExtractors.callExpression('ngettext', {
|
|
|
|
arguments: {
|
|
|
|
text: 1,
|
|
|
|
textPlural: 2,
|
|
|
|
context: 3,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
])
|
2022-04-01 22:49:52 +02:00
|
|
|
.parseFilesGlob('./src/**/*.@(ts|js|tsx)');
|
2022-02-10 18:20:59 +01:00
|
|
|
|
|
|
|
extractor.savePotFile('../wagtail/admin/locale/en/LC_MESSAGES/djangojs.po');
|
|
|
|
|
|
|
|
extractor.printStats();
|