Reputation: 956
I'm trying to design a form which contains a dropdown box containing a list of grocery item choices.
What criteria should I look at when trying to decide on whether to use a java enum or a lookup table? Also, I will need to plan ahead for i18n support for the dropdown strings.
Upvotes: 1
Views: 560
Reputation: 52478
Use a Property Resource Bundle. They are designed for situations like this where you have to add i18n support.
Remember to think about sorting/ordering. Will the list be shown in the same order for all languages? Or sorted alphabetically according to the locale?
Upvotes: 1
Reputation: 4315
I try to minimize look-up tables and use enums and code as much as possible until there is some additional data attached to each item that would need to be persisted. Also I usually use keys in the enum that map to ResourceBundle strings in order to find the right translation.
Upvotes: 1