0

How to make backoffice labels default language to en_GB. Its currently picking up en_US. Using hybris 6.5.

I wasn't able to see the label due to which null was visible on the values, when checked label, it wasn't empty. But had a different language empty(en_US) which I believe is default languae/fallback language being picked up, when i added value in en_US, it worked. I wish it to work in en_GB.

sakshinarang
  • 99
  • 3
  • 14

2 Answers2

2

In OOTB, there is a class BackofficeAuthenticationSuccessHandler. Here it picks the current locale in the class(CockpitLocaleService). Try by writing a custom authentication handler to make changes and set the language you want to show.

Ritika
  • 36
  • 2
  • I have tried that, I tried using this approach, first comment https://answers.sap.com/questions/12763604/backoffice-how-to-set-default-language-to-english.html Dint work. cockpitLocaleService.setCurrentLocale(LocaleUtils.toLocale("en_GB")); For some reason, its not going to that file. Looking into its spring. – sakshinarang Sep 26 '19 at 07:59
0

If you want to change the default locale of backoffice/cockpit login page, without using "language selector" (maybe you don't want to display this selector. So let's suppose that this selector desn't exist):

enter image description here

There is a better solution, that doesn't require java code. Simply all you have to do is override login.zul, buy adding a text input. And note that :

  1. Input name must be : "locale"
  2. Input type must be : "text" (type="hidden" didn't work for me. You can hide it using CSS)

example of login.zul :

 <h:form action="j_spring_security_check" method="post">
     <textbox type="text" placeholder="Email/Username" class="email-input" name="j_username"/>
     <textbox type="password" placeholder="Password" class="email-password" name="j_password"/>
     <textbox type="text" class="hidden-locale-input"  name="locale" value="en"/> 
     <button type="button" class="login" label="Login" />
 </h:form>

All these inputs will be passed to BackofficeAuthenticationSuccessHandler.java as a map. In BackofficeAuthenticationSuccessHandler.java, hybris will use this map and search a parameter named "locale". We already provided this parameter, with his value (en) by creating the input "locale" in login.zul

This will work without overriding the native implementation of BackofficeAuthenticationSuccessHandler.java.

Mostafa
  • 38
  • 3
  • 10