RE: Can't override language keys

Pam Param, modified 6 Years ago. New Member Posts: 5 Join Date: 4/12/19 Recent Posts
Hello,

I tried overriding lithuanian language using this tutorial: https://dev.liferay.com/es/develop/tutorials/-/knowledge_base/7-1/overriding-global-language-keys#create-a-resource-bundle-service-component but for some reason doesn't work with all keys. For example, it overrides 'home' key but not 'sign-in', 'submit', etc.

Also I tried overriding english language but it works as expected...

Maybe someone knows what I'm doing wrong. Thank you in advance.
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Hi Pam,

Can you try doing it such that you refrence Language_lt ... so basically drop all references to the _LT? 
Amos Fong, modified 6 Years ago. New Member Posts: 5 Join Date: 4/12/19 Recent Posts
Thanks for reply, Andrew.

​​​​​​​Sadly, it's still not working.
thumbnail
Christoph Rabel, modified 6 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
Could you try the following lines of code (it didn't work for me either and I made the following change a couple of months ago):


    private final ResourceBundle _resourceBundle = ResourceBundle.getBundle(
    		"content.Language", getLocale(), getClass().getClassLoader(), UTF8Control.INSTANCE);

And I have added this method:

    @Override
    public Locale getLocale() {
        return Locale.JAPAN;
    }
(of course with your own locale, not Japan). I am not sure, if one or both of these changes are necessary, I fiddled with it for a while till it worked.
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Strange that it didn't work. I checked the portal.properties and lt_LT is listed, but it is part of the beta locales. Normally though I thought that just meant that it was still a work in progress so not all of the language keys are necessarily translated (or correctly translated). I just thought dropping the country code might help because I can see in the portal source the that the file is listed as Langauage_lt.properties (no country code). 

​​​​​​​*shrug*
Amos Fong, modified 6 Years ago. New Member Posts: 5 Join Date: 4/12/19 Recent Posts
Christoph,
​​​​​​​I tried your solution but it still doesn't work.
Pam Param, modified 6 Years ago. New Member Posts: 5 Join Date: 4/12/19 Recent Posts
Finally got it working and it was a fail from me. After deploying resource bundle tomcat restart is needed.


I thought it wasn't necessary because  some language keys changed as I said before.
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Really? That is odd because I was always under the impression the the changes were immediate. In fact I am sure I have created language bundle overrides and not had to restart to see the changes. 

I would consider maybe opening a ticket at issues.liferay.com to let them know jay in case it's not the expected behaviour.

​​​​​​​Either way, glad you got it resolved and thanks for sharing your steps emoticon