✨ feat(vscode): 条件表达式按「如果…则…否则…」翻译

This commit is contained in:
cruldra committed 2026-09-25 03:19:42 +08:00
1 parent 3a184eed9b
commit 6897954644
5 files changed
+212 -27

No files matched your search

@@ -82,4 +82,8 @@ export const pythonZhTranslator: Translator = createZhTemplateTranslator({
emptyLiterals: { list: '空列表', dictionary: '空字典' },
stringNodes: ['string'],
commentText,
// `a if c else b` 的三个具名子节点依次是 a、c、b,语法没给它们起字段名
nodeTemplates: {
conditional_expression: ['如果', { namedChild: 1 }, '则', { namedChild: 0 }, '否则', { namedChild: 2 }],
},
})