2022-02-10 18:20:59 +01:00
|
|
|
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: {
|
2022-10-28 12:15:57 +02:00
|
|
|
text: 0,
|
|
|
|
textPlural: 1,
|
2022-02-10 18:20:59 +01:00
|
|
|
context: 3,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
])
|
2022-11-06 12:20:54 +01:00
|
|
|
.parseFilesGlob('./src/**/!(*.test).@(ts|js|tsx)');
|
2022-02-10 18:20:59 +01:00
|
|
|
|
|
|
|
extractor.savePotFile('../wagtail/admin/locale/en/LC_MESSAGES/djangojs.po');
|
|
|
|
|
|
|
|
extractor.printStats();
|