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

vijays80591732
Level 3
January 8, 2019

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

Peter_Puzanovs
Community Advisor
Community Advisor
January 8, 2019

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

vijays80591732
vijays80591732AuthorAccepted solution
Level 3
January 9, 2019

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