Skip to content

Commit

Permalink
fix: pofile extracted comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Sep 9, 2023
1 parent dea4e1e commit fbeea7a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/get-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ export default class GetText {
var id,
pluralId,
isTemplate,
extractedComments = [];
extractedComments,
domain = "test-domain"; // XXX

// single form
const arg = this.#parseCallExpressionArgument( method === "l10nd" ? node.arguments[1] : node.arguments[0], { file, start } );
Expand Down Expand Up @@ -192,11 +193,18 @@ export default class GetText {
message.references = [reference];
}

// domain
if ( domain ) {
message.extractedComments ??= {};
message.extractedComments.domains ??= [];
message.extractedComments.domains.push( domain );
}

// extracted comments
if ( extractedComments ) {
message.extractedComments ?? {};
message.extractedComments ??= {};
message.extractedComments.comments ??= [];
message.extractedComments.push( extractedComments );
message.extractedComments.comments.push( extractedComments );
}

poFile.addMessages( { [id]: message } );
Expand Down

0 comments on commit fbeea7a

Please sign in to comment.