sakshinarang
sakshinarang

Reputation: 99

How to change backoffice labels default language

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.

Upvotes: 0

Views: 2401

Answers (2)

Mostafa
Mostafa

Reputation: 38

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.

Upvotes: 0

Ritika
Ritika

Reputation: 36

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.

Upvotes: 2

Related Questions