Incorrect usage of Trans (Macro) #2220
-
Hi, I m trying to migrate a big project from v4 to v5.
In this project, I used lingui extensively, using custom translation ids and reusing ids when the same string is needed mutliple times. <Trans id="myCustomTranslationId">
Something to translate
</Trans> When I needed the same translation again, I would simply write This has worked in v2 when I started, through v3 and v4 (v4.7.1) – but now in v5 it breaks (v5.3.0). Don't get me wrong, I am fine with things working differently in the new version, but right now I am unsure how to migrate… Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Do you use Typescript? If yes, you should have tons of errors in the typescript as well. If you want just to show message by id you need By the way, this is an error-prone, time-consuming and hard to maintenance approach. |
Beta Was this translation helpful? Give feedback.
All problems you listed are fixed now in v5:
It now possible to make explicit labeled placeholder so changes to variables name, which by design should not change the behavior would not change the placeholder name
There is a eslint rule which forces this pattern, and i also considered an automatic migration and sunsetting of using identifier name as placeholder. It looks useful from first impression but then reveal problems as you mentioned.