13 Replies Latest reply on Jan 9, 2019 4:48 AM by vijays80591732

    i18n translation not working in AEM 6.4

    vijays80591732 Level 1

      Hi All,

       

      After upgrade my project from AEM 6.1 to AEM 6.4, i18n translation is not working. I could see this has been deprecated in AEM 6.4. Is this causing any issue?

       

      I tried with below steps but didn't workout,

       

      1) Restarted Apache Sling Internationalization Support.

      2) added sling:message in /oak:index/nodetype -> declaringNodeTypes and reindexed.

       

      can anyone help me on this?

       

      smacdonald2008 kautuk sahni Arun Patidar jorgeh3453905

       

      Thanks,

      Vijay

        • 1. Re: i18n translation not working in AEM 6.4
          gauravb10066713 Level 3

          Try this - i18n translations are no longer working

          Validate the ACL of service user that you have created in 6.4. Logging-in as Admin or any other user won't help but the ACLs configured on the service user.

          • 2. Re: i18n translation not working in AEM 6.4
            smacdonald2008 Adobe Employee

            I asked our translation team to check this thread.

            • 3. Re: i18n translation not working in AEM 6.4
              vijays80591732 Level 1

              Hi Gaurav,

               

              I'm facing this issue in my local AEM 6.4 and I logged in as Admin. I have verified the ACLs and I'm having the read access for the below highlighted services. Do I need to check anything apart from this?

               

               

              Thanks,

              Vijay

              • 4. Re: i18n translation not working in AEM 6.4
                vijays80591732 Level 1

                Thanks Smac. Will wait for your further updates.

                 

                I'm facing this issue in AEM 6.4 with SP1. I could see this path has been deprecated /libs/cq/i18n/translator. I'm suspecting this causing the issue. FYI.

                 

                Also In 6.4 SP3, there was an hot fix which is related to i18n. Do you have any inputs on this hotfix? Why the hotfix required?

                • Performance issues with org.apache.sling.i18n. NPR-26812: Hotfix for SLING-7543

                 

                 

                Thanks,

                Vijay

                • 5. Re: i18n translation not working in AEM 6.4
                  gauravb10066713 Level 3

                  Couple of things:

                  1) Check if all the i18n bundles are active in /system/console/bundles

                  2) Check the error.log for any i18n related errors. Bounce the server, if required and check.

                  3) Find the service user's name under Apache Sling Service User Mapper Service Amendment. It should be something like

                     Mapping: org.apache.sling.i18n=[repository-reader-service]  The name within brackets is your service user for i18n bundle. For translation service, it might be a different service user like

                  com.day.cq.wcm.cq-wcm-translation:translation-job=translation-job-service

                  4) Check the ACLs of this service user on the root node via /crx/explorer > Security > Access Control Editor & fix it if required.

                   

                  http://localhost:4502/libs/cq/i18n/translator.html works fine with SP3 and the docs doesn't mention anything about it being deprecated - Using Translator to Manage Dictionaries

                   

                  If this doesn't work then install a fresh instance and check if OOB translations work fine? It doesn't harm in trying with SP3 as well.

                   

                  Please share your code and the steps/screenshots to reproduce the issue and to fix the issue.

                  • 6. Re: i18n translation not working in AEM 6.4
                    bsloki Experience Cloud MVP

                    I would suggest you to try with SP3 and see if you still have this issue.

                    • 7. Re: i18n translation not working in AEM 6.4
                      Jörg Hoh Adobe Employee

                      What do you mean with "i18n" translation is not working? Can you describe the symptoms? What do you expect and how does it work on AEM 6.1 and on AEM 6.4?

                      • 8. Re: i18n translation not working in AEM 6.4
                        vijays80591732 Level 1

                        Hello Jorg,

                         

                        In my application we are overriding the default i18n translation and we are not using libs/cq/i18n/translator.html to get the values for our i18n keys. Rather we are using customized dictionary which will be available in some path like this /content/translation/de/jc:content/translation. Inside this translation node i will be having my keys and values like this  banner.cta.button="Rückruf". So whenever I call the @i18n it will trigger my java class (service) and it will be calling this node /content/translation/de/jc:content/translation and get the value for my corresponding key. This functionality is working fine in AEM 6.1 and the same is not working in AEM 6.4. When I debug this in AEM 6.1 this particular service is getting triggered whenever I call @i18n from the AEM frontend components, but the same service is not getting triggered in AEM 6.4. The service will be something like below,

                         

                        @Component

                        @Service(RuntimeExtension.class)

                        @Properties({ @Property(name = RuntimeExtension.NAME, value = I18nTenantRuntimeExtension.I18N_TRANSLATION_FUNCTION),

                        @Property(name = Constants.SERVICE_RANKING, intValue = 10000) })

                        public class I18nTenantRuntimeExtension implements RuntimeExtension {

                         

                         

                        @Reference

                        private ConfigService configService;

                         

                         

                        private static final Logger LOG = LoggerFactory.getLogger(I18nTenantRuntimeExtension.class);

                        public static final String I18N_TRANSLATION_FUNCTION = "i18nTranslation";

                        public static final String KEY_PREFIX = "Key: ";

                         

                         

                        @SuppressWarnings("unchecked")

                        @Override

                        public Object call(final RenderContext renderContext, Object... arguments) {

                        checkArgumentCount(I18nTenantRuntimeExtension.I18N_TRANSLATION_FUNCTION, arguments, 2);

                        String text = RenderUtils.toString(arguments[0]);

                        Map<String, Object> options = (Map<String, Object>) arguments[1];

                        Object locale = options.get("locale");

                        final Bindings bindings = renderContext.getBindings();

                        final boolean debugEnabled = getDebugEnabledConfig(renderContext);

                        return get(bindings, text, locale, debugEnabled);

                        }

                         

                        Thanks,

                        Vijay

                        • 9. Re: i18n translation not working in AEM 6.4
                          Jörg Hoh Adobe Employee

                          Hi,

                           

                          now I understand your problem, but I cannot help you. Looks you have a customized i18n implementation for HTL already in AEM 6.1, and this does not work anymore with AEM 6.4. I can only recommend to have a look at the changes between the HTL versions shipped with these AEM versions.

                           

                          Jörg

                          • 11. Re: i18n translation not working in AEM 6.4
                            vijays80591732 Level 1

                            Hi Jorg,

                             

                            Are you saying that customized i18n translation will not work in AEM 6.4? Also I believe most of the HTL version has been upgraded in AEM 6.4. Can you please let me know what version I need to check?

                             

                            Thanks,

                            Vijay

                            • 12. Re: i18n translation not working in AEM 6.4
                              PuzanovsP Experience Cloud MVP

                              Hey Vijay,

                               

                              Normal OOTB translations work fine here with 6.4 SP1.

                               

                              Make sure you build with correct version of sightly library that's compatible with 6.4 SP1.

                               

                              For your customisation, do you see your custom RuntimeExtension being printed/registered under:

                              /system/console/services org.apache.sling.scripting.sightly.extension.RuntimeExtension ?

                               

                              In SLING-6125 scripting moved to osgi.annotations, could you try your Extension with osgi annotation?

                               

                              HTL code is very well written and contains a lot of Exceptions with clear messaging when something can't be registered right, do you get any Exceptions during your bundle startup?

                               

                              Regards,

                              Peter

                              • 13. Re: i18n translation not working in AEM 6.4
                                vijays80591732 Level 1

                                Hi Puzanovs,

                                 

                                Thanks for your input and the issue has been fixed now.

                                 

                                The way of calling the service (I18nTenantRuntimeExtension) should be something different in AEM 6.4.

                                 

                                Below are the fix:

                                • Removed felix annotations and placed OSGI annotations.
                                • Added org.apache.sling.scripting.sightly.compiler.java dependency in parent.pom and bundle.pom. This is the dependency which we are using for RuntimeExtension interface.
                                • In I18nTenantRuntimeExtension the property value is “i18ntranslation” in AEM 6.1, but the property value should be “i18n” in AEM 6.4

                                 

                                 

                                In felix (before fix):

                                 

                                @Component

                                @Service(RuntimeExtension.class)

                                @Properties({

                                    @Property(name = RuntimeExtension.NAME,

                                        value = I18nTenantRuntimeExtension.I18N_TRANSLATION_FUNCTION),

                                    @Property(name = Constants.SERVICE_RANKING, intValue = 10000)})

                                public class I18nTenantRuntimeExtension implements RuntimeExtension {

                                  @Reference

                                  private ConfigService configService;

                                 

                                  private static final Logger LOG = LoggerFactory.getLogger(I18nTenantRuntimeExtension.class);

                                  public static final String I18N_TRANSLATION_FUNCTION = "i18nTranslation";

                                  public static final String KEY_PREFIX = "Key: ";

                                 

                                 

                                In OSGI (after fix):

                                 

                                @Component(

                                        service = RuntimeExtension.class,immediate = true,

                                        property = {

                                I18nTenantRuntimeExtension.NAME + "=" + I18nTenantRuntimeExtension.I18N,

                                I18nTenantRuntimeExtension.SERVICE_RANKING + "=" + 10000

                                        }

                                )

                                public class I18nTenantRuntimeExtension implements RuntimeExtension {

                                 

                                  private ConfigService configService;

                                 

                                  @Reference

                                  public void bindConfigService(ConfigService configService) {

                                    this.configService = configService;

                                  }

                                 

                                  public void unbindConfigService(ConfigService configService) {

                                    this.configService = configService;

                                  }

                                 

                                  private static final Logger LOG = LoggerFactory.getLogger(I18nTenantRuntimeExtension.class);

                                  public static final String NAME = "org.apache.sling.scripting.sightly.extension.name";

                                  public static final String I18N = "i18n";

                                  public static final String SERVICE_RANKING = "service.ranking";

                                  public static final String KEY_PREFIX = "Key: ";

                                 

                                 

                                Thanks smacdonald2008 gauravb10066713 bsloki @Jorg

                                 

                                Thanks,
                                Vijay