Replies: 1 comment
-
Hi, thanks for your kind words! However, I don't think this is something I would include in the framework, as it is quite opinionated (I don't structure my translation files like that, for example) and is something you could have in your project, or something that you could release in a package. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@danharrin
I recently used Filament for the first time in a project and am blown away by the amount of features and the structure and thoughtfulness of the framework. Great work!
I'm a big fan of enums and use them a lot where appropriate. What I find helpful is the feature of autoloading their display names by simply implementing the
HasLabel
interface and agetLabel
method in an enum, returning a string for their matching case.But I thought this feature could be taken a step further, providing the following benefits:
getLabel
method could easily be abstracted away)So I would like to contribute a
Translatable
trait for enums, that provides autoloading of enum translations from Laravel translation files by simply implementing it in an enum.For example:
This is enough to provide the benefits I discussed above, but also keeps the possibility of organizing enum display names in the old way. Is the contribution of a
Translatable
trait doing this suitable for the framework?Beta Was this translation helpful? Give feedback.
All reactions