From 8a3f5893bef1774cb8bfac89835478e051d77a95 Mon Sep 17 00:00:00 2001 From: Malthe Borch Date: Thu, 4 Apr 2024 13:07:47 +0200 Subject: [PATCH] Fix issue where macro would not get correctly rendered for a translation name --- CHANGES.rst | 4 +++- src/chameleon/compiler.py | 2 +- src/chameleon/tests/inputs/128-translation-macro-name.pt | 5 +++++ src/chameleon/tests/outputs/128-en.pt | 3 +++ src/chameleon/tests/outputs/128.pt | 3 +++ 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/chameleon/tests/inputs/128-translation-macro-name.pt create mode 100644 src/chameleon/tests/outputs/128-en.pt create mode 100644 src/chameleon/tests/outputs/128.pt diff --git a/CHANGES.rst b/CHANGES.rst index 51a2d2f8..ae1f2c5c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,7 +3,9 @@ Changes In next release ... -- +- Fix a bug where a macro could not be used correctly to render a + translation name. + (`#419 `_) 4.5.2 (2024-01-29) ------------------ diff --git a/src/chameleon/compiler.py b/src/chameleon/compiler.py index 6e77a937..68d17e11 100644 --- a/src/chameleon/compiler.py +++ b/src/chameleon/compiler.py @@ -1703,7 +1703,7 @@ def visit_Name(self, node): # generate code code = self.visit(node.node) - body.append(TranslationContext(code, append)) + body.append(TranslationContext(code, append, stream)) # output msgid text = Text('${%s}' % node.name) diff --git a/src/chameleon/tests/inputs/128-translation-macro-name.pt b/src/chameleon/tests/inputs/128-translation-macro-name.pt new file mode 100644 index 00000000..32401c04 --- /dev/null +++ b/src/chameleon/tests/inputs/128-translation-macro-name.pt @@ -0,0 +1,5 @@ +Fancy link + + + Now follows a fancy link: + diff --git a/src/chameleon/tests/outputs/128-en.pt b/src/chameleon/tests/outputs/128-en.pt new file mode 100644 index 00000000..4fbd7d10 --- /dev/null +++ b/src/chameleon/tests/outputs/128-en.pt @@ -0,0 +1,3 @@ +Fancy link + +Now follows a fancy link: Fancy link ('text_with_link' translation into 'en') diff --git a/src/chameleon/tests/outputs/128.pt b/src/chameleon/tests/outputs/128.pt new file mode 100644 index 00000000..eaa9aa2e --- /dev/null +++ b/src/chameleon/tests/outputs/128.pt @@ -0,0 +1,3 @@ +Fancy link + +Now follows a fancy link: Fancy link