Skip to content

Commit

Permalink
fix: l10n tags
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Sep 10, 2023
1 parent f6a1d31 commit 13f27d8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/get-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,16 @@ export default class GetText {
}
else if ( property.value.type === "ArrayExpression" ) {
for ( const element of property.value.elements ) {
if ( element.type !== "Literal" ) continue;

res.tags ??= [];
res.tags.push( element.value );
if ( element.type === "Literal" ) {
res.tags ??= [];
res.tags.push( element.value );
}
else if ( element.type === "TemplateLiteral" ) {
if ( element.quasis.length === 1 ) {
res.tags ??= [];
res.tags.push( element.quasis.map( node => node.value.cooked ).join( "${n}" ) );
}
}
}
}
}
Expand Down

0 comments on commit 13f27d8

Please sign in to comment.