Translatable. How to use it for SelectDropDownList?

Hi there,

I the API Reference I found Interface Translatable.
And it says “To have drop down list items translatable, the items must implement this interface.”.

It sounds great, but… how can I do this? Does anyone have a litlle code sample on this?

This is applicable only URCap nodes with an HTML based UI.
When adding an item to a SelectDropDownList, this is the generic Object type.
If this Object (i.e. a new class of yours) implements the Translatable interface, the shown name in the dropdown will be the returned String from the getTranslatesText( Locale locale ) method.

For Swing based nodes this is default Java functionality.
Just @Override on toString() for the object you add to the JComboBox.

1 Like

Thank you @jbm! Your explamation is very clear.

I eventually had it working… but took me a little time without this post.