Good stuff, nice bit of investigation. I wrote that stuff, but had forgotten about it.
So, if you put a breakpoint on line 144 [1], does it get hit? Also, it looks like if you define a title() method returning a TranslatableString, then that will get called instead, with a slightly different context being used for the lookup of the translation [2] Let me know what you find out... Dan [1] https://github.com/apache/isis/blob/isis-1.9.0/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/choices/enums/EnumValueSemanticsProvider.java#L144 [2] https://github.com/apache/isis/blob/isis-1.9.0/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/choices/enums/EnumValueSemanticsProvider.java#L126 On 29 September 2015 at 15:34, Burbach, Matthias <matthias.burb...@tui.de> wrote: > I found this as a hint it may exist in 1.9.0 (the version which I am > using): https://issues.apache.org/jira/browse/ISIS-1106 > > EnumValueSemanticsProvider: > > @Override > protected String titleString(final Object object, final Localization > localization) { > + final TranslationService translationService = > getDependencyInjector().lookupService(TranslationService.class); > + > if (titleMethod != null) { > - final TranslationService translationService = > getDependencyInjector().lookupService(TranslationService.class); > // sadness: same as in TranslationFactory > final String translationContext = > titleMethod.getDeclaringClass().getName() + "#" + titleMethod.getName() + > "()"; > > @@ -135,7 +137,11 @@ public class EnumValueSemanticsProvider<T extends > Enum<T>> extends ValueSemantic > } > } > > - return object.toString(); > + // simply translate the enum constant's name > + Enum<?> objectAsEnum = (Enum<?>) object; > + final String translationContext = object.getClass().getName() + > "#" + objectAsEnum.name(); > + final String friendlyNameOfEnum = > Enums.getFriendlyNameOf(objectAsEnum.name()); > + return translationService.translate(translationContext, > friendlyNameOfEnum); > } > > > > Am 29.09.15 16:29 schrieb "Dan Haywood" unter > <d...@haywood-associates.co.uk>: > > >Um, I'm not 100% certain this is implemented, actually. Sorry about that. > >I'll double check this evening. > > > >If you want to raise a ticket anyway, that'll be fine. If it turns out > >there is a way then at the very least it would still need to be > >documented... > > > >Thx > >Dan > > > > > > > >On 29 September 2015 at 15:24, Burbach, Matthias <matthias.burb...@tui.de > > > >wrote: > > > >> Hi, > >> I am trying to translate enum values like so, but it has no effect. > >> > >> package domainapp.dom.simple; > >> ... > >> public class Item implements Comparable<Item> { > >> ... > >> > >> //region > item group (property) > >> public enum ItemGroup { > >> KeyUser, > >> Provider, > >> Unit > >> } > >> private ItemGroup itemGroup; > >> @javax.jdo.annotations.Column(allowsNull = "false") > >> public ItemGroup getItemGroup() {return itemGroup;} > >> public void setItemGroup(final ItemGroup itemGroup) {this.itemGroup > >>= > >> itemGroup;} > >> //endregion > >> ... > >> > >> } > >> > >> file translations-en.po: > >> ... > >> #: domainapp.dom.simple.Item$ItemGroup#KeyUser > >> msgid "Key User" > >> msgstr "Key User" > >> ... > >> > >> > >> I am not sure if this feature exists at all or if am just using it > >> wrongly, there some hints out there but not very clear to me. > >> > >> Regards, > >> Matthias > >> > >> > >