views:

236

answers:

2

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.

+1  A: 

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.

Jonas Klemming
+1  A: 

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?

Steve McLeod