Skip to content

Commit e8b06e2

Browse files
committed
[FIX] parser: distribute translation nodes over multi nodes
1 parent c2728c9 commit e8b06e2

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/compiler/parser.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,9 +921,19 @@ function parseTTranslation(node: Element, ctx: ParsingContext): AST | null {
921921
return null;
922922
}
923923
node.removeAttribute("t-translation");
924+
const result = parseNode(node, ctx);
925+
if (result?.type === ASTType.Multi) {
926+
return {
927+
type: ASTType.Multi,
928+
content: result.content.map((n) => ({
929+
type: ASTType.TTranslation,
930+
content: n,
931+
})),
932+
};
933+
}
924934
return {
925935
type: ASTType.TTranslation,
926-
content: parseNode(node, ctx),
936+
content: result,
927937
};
928938
}
929939

@@ -937,9 +947,20 @@ function parseTTranslationContext(node: Element, ctx: ParsingContext): AST | nul
937947
return null;
938948
}
939949
node.removeAttribute("t-translation-context");
950+
const result = parseNode(node, ctx);
951+
if (result?.type === ASTType.Multi) {
952+
return {
953+
type: ASTType.Multi,
954+
content: result.content.map((n) => ({
955+
type: ASTType.TTranslationContext,
956+
content: n,
957+
translationCtx,
958+
})),
959+
};
960+
}
940961
return {
941962
type: ASTType.TTranslationContext,
942-
content: parseNode(node, ctx),
963+
content: result,
943964
translationCtx,
944965
};
945966
}

0 commit comments

Comments
 (0)