mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-22 02:18:39 +01:00
e609f15a93
Avoid unit test translation usage from being added to translation strings
32 lines
692 B
JavaScript
32 lines
692 B
JavaScript
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: 0,
|
|
textPlural: 1,
|
|
context: 3,
|
|
},
|
|
}),
|
|
])
|
|
.parseFilesGlob('./src/**/!(*.test).@(ts|js|tsx)');
|
|
|
|
extractor.savePotFile('../wagtail/admin/locale/en/LC_MESSAGES/djangojs.po');
|
|
|
|
extractor.printStats();
|