Locale missing while extending the TaxonomyEditorPlugin

Hi,

In the past we have extended the TaxonomyEditorPlugin class in order to be able to add taxonomy items from a custom model (pretty much like mentioned over here: https://documentation.bloomreach.com/library/concepts/plugins/taxonomy/category-detail-view-editor-customization.html). Now that we are migrating to Hippo 13, however, we are running into an issue that sounds like https://issues.onehippo.com/browse/GOGREEN-1194. In short: the categoryComparator instance does not contain a locale, which causes the category sorting to break. Within the constructor of the TaxonomyEditorPlugin, the categoryComparator is instantiated using the currentLocaleSelection value. At that point in time, unfortunately, currentLocaleSelection is already null. A setter of the currentLocaleSelection field is available, but it not clear to me where it is being called. Does anyone happen to know what could be the cause of this (and preferrable how to solve this issue)? Thanks in advance, Robin.

Hi Robin,
It seems a bug to me that currentLocaleSelection is set after it’s used as argument:

categoryComparator = getCategoryComparator(config, currentLocaleSelection);
...
currentLocaleSelection = getLocale();

Doe the CategoryNameComparator break or your custom comparator?
You should be able to get hold of the locale using org.apache.wicket.Session.get().getLocale()

HTH
Jeroen

Thanks Jeroen, overriding the getCategoryComparator method using the session locale works like a charm.

Cheers,
Robin.