Following the documentation here, I am trying to get i18n working on my AEM 6.2 instance:
Locale pageLang = currentPage.getLanguage(false);
ResourceBundle resourceBundle = slingRequest.getResourceBundle(pageLang);
I18n i18n = new I18n(resourceBundle);
The problem is, I always get a org.apache.sling.engine.impl.helper.NullResourceBundle
which seems to be just an empty fallback bundle if nothing was found. I tried to preload the bundles in the OSGi configuration, but to no avail.
Even if my own translations wouldn't work, at least it should contain the predefined translations provided with the product. Though my own show up in the tool: http://localhost:4502/libs/cq/i18n/translator.html
Any ideas why I don't get a valid resource bundle?
EDIT: I did a simple JSP test and there it works, so it is related to Sling Models where the code resides within a @PostConstruct
method where the model was adapted from the SlingHttpServletRequest