Skip to content

Commit

Permalink
Include translator comments in .pot file
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Dec 31, 2024
1 parent 4a5250a commit cb649d4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/meta/src/wordpress-i18n-gettext-extractor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,40 @@ export function extractWordPressI18nGettext({
}) {
const extractor = new GettextExtractor();

const comments = {
otherLineLeading: true,
sameLineLeading: true,
sameLineTrailing: true,
regex: /translators.*/is,
};
const jsParser = extractor.createJsParser([
JsExtractors.callExpression('__', {
arguments: {
text: 0,
},
comments,
}),
JsExtractors.callExpression('_x', {
arguments: {
text: 0,
context: 1,
},
comments,
}),
JsExtractors.callExpression('_n', {
arguments: {
text: 0,
textPlural: 1,
},
comments,
}),
JsExtractors.callExpression('_nx', {
arguments: {
text: 0,
textPlural: 1,
context: 3,
},
comments,
}),
]);

Expand Down

0 comments on commit cb649d4

Please sign in to comment.