Add support for i18n to AdapterFactory


It would be great to have a feature to easily inject a i18n Helper to resolve translations from the i18n files.


Igor Sechyn
October 20, 2014, 8:05 AM

i can confirm, that this is working, but the injection of the i18n object makes it impossible to write unit tests for request based models. it always throws following exception:

furthermore it would be nice to have an option to mock the i18n object, when using the AemContext.

Stefan Seifert
October 20, 2014, 9:07 AM

which was not a problem in the injector but in or page mock - fixed in master

Alexander Muthmann
October 20, 2014, 9:09 AM

Can you please retest and close this ticket afterwards? I18n in Components works fine for me now, thank

Igor Sechyn
January 9, 2015, 3:27 PM

There is another issue with the injection of the I18n object, when it is injected in models adapted for example from the Request of the Post Servlet. In this case the SlingBindings attribute is not set, since no script resolving is involved. In this case the original request is used, which is the instance of the class. This instance returns the NullResourceBundle, which does not provide any i18n support.

the only workaround I came up with, was to use the resource for adaption instead of request, in this case the AemInjector uses the request from ModelsImplConfiguration service and everything works fine.

As a solution when injecting the I18n object, we might want to try the slingBindings request, then fallback to the one from ModelsImplConfiguration and only then try the original one.

Stefan Seifert
January 14, 2015, 11:06 AM

please do not reopen already implemented feature tickets for bug reports - i've created





Alexander Muthmann




Fix versions