You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now we expect the translation key to be enums.{className}.{value}.
This works well but as applications grow, so too may the number of enums.
Or users may have enums that are part of a module so they may be more localised.
I think we should check if a method public function getTranslationKey(static $value): string exists and if so use the return value from that.
Otherwise it should defaults to how it behaves currently.
We should not move the logic to a method with this name by default.
This is so a user may simply define a trait with this method and use it on their enums.
If we defined this method in our traits then users would be required to tell the enum which of the traits it should use the method from which isn't a great DX.
This discussion was converted from issue #20 on April 30, 2024 04:48.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Right now we expect the translation key to be
enums.{className}.{value}
.This works well but as applications grow, so too may the number of enums.
Or users may have enums that are part of a module so they may be more localised.
I think we should check if a method
public function getTranslationKey(static $value): string
exists and if so use the return value from that.Otherwise it should defaults to how it behaves currently.
We should not move the logic to a method with this name by default.
This is so a user may simply define a trait with this method and use it on their enums.
If we defined this method in our traits then users would be required to tell the enum which of the traits it should use the method from which isn't a great DX.
Beta Was this translation helpful? Give feedback.
All reactions