i18n translation not working in AEM 6.4 | Community
Skip to main content
vijays80591732
Level 3
December 31, 2018
Solved

i18n translation not working in AEM 6.4

  • December 31, 2018
  • 13 replies
  • 10950 views

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?

smacdonald2008kautuksahniArun Patidarjorgeh3453905

Thanks,

Vijay

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by vijays80591732

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 smacdonald2008gauravb10066713bsloki​ @Jorg

Thanks,
Vijay

13 replies

Gaurav-Behl
Level 10
December 31, 2018

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.

smacdonald2008
Level 10
December 31, 2018

I asked our translation team to check this thread.

vijays80591732
Level 3
January 1, 2019

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

vijays80591732
Level 3
January 1, 2019

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

Gaurav-Behl
Level 10
January 1, 2019

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.

Lokesh_Shivalingaiah
Level 10
January 2, 2019

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

joerghoh
Adobe Employee
Adobe Employee
January 3, 2019

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?

vijays80591732
Level 3
January 8, 2019

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

joerghoh
Adobe Employee
Adobe Employee
January 8, 2019

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

vijays80591732
Level 3
January 8, 2019