-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getDescription overwrites Localization #94
Comments
Hi @MartinP7r, what you've described is exactly how the default implementation of the getDescription method works. Take a look at: |
Sorry @BenSampo, I don't think I expressed my question clear enough (wasn't even a question, sorry for that. Not much sleep 😅) https://github.com/BenSampo/laravel-enum#overriding-the-getdescription-method Thinking about it, that's probably hard to work around, without implementing a different method for overriding |
Ah in that case, apologies for being hasty in closing the issue, will re-open it. I'm not 100% on the problem still. Can you let me know what you're trying to achieve? Any code examples would be useful. The way I see it is that you either:
Any enum values not explicitly defined here will fallback to the default implementation of checking localisation files or subsequently generating a friendly name.
|
Sorry for my late response. Going over all of it, leaving the implementation as-is would is probably best, since it's probably a minor thing but I try to give an explanation of what I was having problems with, below. Essentially, you can only use localization if there is no overridden implementation of BUT, if you have an application with e.g. 10 different languages, where the fallback is English This might be a strange way of looking at it. So I really don't mind closing this issue again if you feel like it makes little sense. |
when implementing a custom
getDescription()
method, localization via LocalizedEnum stops working. Maybe I'm using it wrong, but I would have preferred the getDescription() implementation to work as a fallback if there's no localization for the particular language.The text was updated successfully, but these errors were encountered: