cancel
Showing results for 
Search instead for 
Did you mean: 

Type localization missing in Backoffice

0 Kudos

We are confused by an issue that we are currently running into with the hybris backoffice.

Actual Situation:

  • We define type localizations in the file customer-localization_en.properties.

  • The customer uses two data locales en_US (with fallback set to en) and de_DE (with fallback set to de)

  • The login to the backoffice uses the locale en_US.

  • After the installation and update everything looks fine.

  • After a restart of the server, some of the type localizations are missing, even hybris standard ones, like product.name.

Findings

  • We debugged already and found out that the type localization does not follow the configured fallback languages like the data languages do in the facade layer.

  • Instead, type localization will always fallback from Country isocode (e.g. en_US) to Language isocode (e.g. en), i.e. using only the first two characters.

  • We couldn't find, why the localization are not resolved properly

Possible solutions

  • Copy type localization into a second file customer-localization_en-US.properties (which we would like to avoid)

Questions

  • Has someone seen this issue before?

  • What could be the issue here?

  • Do you see different solutions for this issue?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hey Wojtek,

thanks for investigating into this issue. Your tip is very interesting. Unfortunately, it didnt solve our issue.

We found, that within the project the default location service was overridden. For user anonymous it only returned a single language, such that the login screen with the backoffice cockpit did only show up one language.

Unfortunately, the Typesystem cache for localizations is built upon the first request (that is anonymous of course) and, therefore, the cache ignores all other languages...

We changed it back and applied the same trick only for the backoffice location service and with this in place, everything works fine:

 <alias name="customerBackofficeLocaleService" alias="cockpitLocaleService"/>
 <bean id="customerBackofficeLocaleService" parent="backofficeLocaleService">
     <property name="i18nService" ref="customerBackofficei18nService"/>
 </bean>
 
 <bean id="customerBackofficei18nService" parent="defaultI18NService">
     <property name="localeService" ref="anonymousOnlyEnForLoginLocalizationService"/>
 </bean>

This might help others that want to limit the login to a certain UI language.

Best bechte

Answers (2)

Answers (2)

Former Member
0 Kudos

I don't know if this is related to your problem. But we had a wrong localization only in the promotion conditions and actions editor. It was english, although the rest of the backoffice was german. This is cause by a wrong I18NService#getCurrentLocale which was in fact the system locale. CockpitLocaleService returned the locale set at the login page.

This solved our problem:

 public class CustomCockpitMainWindowComposer extends CockpitMainWindowComposer
 {
     @Override
     public void doAfterCompose(final Component comp) throws Exception
     {
         i18nService.setCurrentLocale(cockpitLocaleService.getCurrentLocale());
         super.doAfterCompose(comp);
     }

And in our *backoffice-spring.xml:

 <alias name="customCockpitMainWindowComposer" alias="cngMainWindowComposer" />
     <bean id="customCockpitMainWindowComposer" class="com.kps.hybris.backoffice.cockpitng.customCockpitMainWindowComposer"
         parent="defaultCngMainWindowComposer" scope="prototype">
 
         <property name="i18nService" ref="i18nService" />
         <property name="cockpitLocaleService"
             ref="cockpitLocaleService" />
     </bean>
former_member632755
Active Contributor
0 Kudos

Hi Stefan,

we recently discovered similar issues with languages with no fallback set. There is already a bug reported to enable fallback out-of-the-box. Anyway this will be fixed only in the latest version, therefore I would have a few questions and ideas:

  • which version you are using (we may consider backports)

  • do you have all the files named correctly (once you mention en-US and once an_US, where only the later is correct)

If the problem is related to the fallback enablement I would suggest to try the following:

Override the bean:

 <alias name="defaultCngMainWindowComposer" alias="cngMainWindowComposer"/>
 <bean id="defaultCngMainWindowComposer" class="com.hybris.cockpitng.admin.CockpitMainWindowComposer" scope="prototype"/>

and re-implement the method com.hybris.cockpitng.admin.CockpitMainWindowComposer#doAfterCompose, in which, before calling super, you should call de.hybris.platform.servicelayer.i18n.I18NService.setLocalizationFallbackEnabled(true). This should enable the standard resolution of fallback language-based tranaslations.

Please let me know if this helps. If for any reason it will turn out to be too late (in the composer) as as a quick and dirty trial you may try to register a filter to enable the fallbacks.

Cheers,

Wojtek