Open rodionmoiseev opened 4 years ago
Being able to specify translations directly on the values of the Enum
don't really like this, it is not always possible to directly modify the enum to add locale annotations, and beside a separate PetMessages seems a more clean approach
Inspired by @lelmarir Automated Enum binding with Guice commit.
Motivation
Currently providing locale sensitive translations for Enums is relatively complex. In overview it requires 2 steps:
The biggest problems with this approach are:
A Better Approach
Being able to specify translations directly on the values of the Enum seems to do the job better:
Enum-type arguments can be retrieved and cached at c10n initialization time, in the same way other standard translations are fetched, instead of c10n interface method invocation time.
This approach would make Enum support more transparent, with no extra configuration, and with less overhead.
It would also work transparently with other c10n extensions, such as external/internal resource loading, Guice support and Logging tool.