RE: Localization of custom field's name

Carlos Barreiro, modified 6 Years ago. New Member Posts: 16 Join Date: 11/25/19 Recent Posts
Hello all, if we create a custom field programatically (favourite_color), it is displayed as "Favourite Color" in Liferay, which is OK if we have English selected. But how we could localize the name in other languages? I suppose that I should use the Language_<language>.properties to set the translation that I want to show in each language, but what key should I specify?
Thanks and regards emoticon
thumbnail
Mohammed Yasin, modified 6 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Hi ,You can try using Custom field name as key 
Carlos Barreiro, modified 6 Years ago. New Member Posts: 16 Join Date: 11/25/19 Recent Posts
Hello Mohammed, thanks for the suggestion! But it didn't work emoticon Maybe it needs some special word before the favourite_color part in the key.
thumbnail
Mohammed Yasin, modified 6 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
i dont think any special character is required , it only  uses LanguageUtil.get(request, name); for getting  the localized name , also  favourite_color  come as Favourite Color this is due to TextFormatter  which is used to display that
Carlos Barreiro, modified 6 Years ago. New Member Posts: 16 Join Date: 11/25/19 Recent Posts
You are right emoticon With the field's name is enough. The problem I was having actually was that the Language file I was modifying was only loaded by a certain module. The language file containing the field's name should be one loaded by a module that uses the ResourceBundle service.
Thanks!
thumbnail
Mohammed Yasin, modified 6 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Yes you need to Resource bundle service for overriding  Portal langauge.properties,
may be below link can help you
https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/overriding-language-keys