-
-
Notifications
You must be signed in to change notification settings - Fork 430
Open
Description
Lingui supports deriving name of the placeholder from the variable name. It might sounds like a cool idea at the first glance, but that has few unexpected consequences.
Developers used to the fact that variable name doesn't affect how code is working. So renaming a variable should not break anything.
When a placeholder name is inherited from a variable name - it's breaking this rule, and developer could accidentaly rename variable and it would break the translation unexpectedly.
Also this inheritance will not work in the full-runtime macro which i'm having plans of implementing.
So i want to push thru the documentation and eslint rule to use a named placeholders evereywhere, and deprecate the old way.
ToDo List:
- Labeled placeholders implementation feat: add ph() and explicit labels for placeholders #2092
- Initial support of labeled placeholder ins the
no-expression-in-messagerule feat(no-expression-in-message): add support for ph and explicit labels eslint-plugin#100 - Support labeled placeholders in SWC plugin feat: support ph and explicit labels in t and Trans swc-plugin#139
- Add suggestion to the error message of
no-expression-in-messageto use a labeled placeholder - Add autofix suggestion for the
no-expression-in-messageconverting to labeled placeholder - Write a separate guide for using placeholders in the lingui's
tandTrans - Mention in Agent Skills
- Create a migration to fix the whole project at once (?? TBD)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels