Page 1 of 1

Property group translation

PostPosted:Wed Jul 26, 2017 2:13 pm
by Petr_Valenta

Is there any way how to define property groups to display labels according the the chosen language?

Thanks a lot in advance for your answer.


Re: Property group translation

PostPosted:Fri Jul 28, 2017 9:00 am
by jllort
Is not possible, should be modified the source code for it. Might be done but it means do some internalization with property group labels. If you want we give to you some clues about how doing it, tell us and I will give you some clues about how doing it. The idea should be have labels internationalized and from the FormManager try to translate it ( should work with internationalized and not labels at the same time, basically the should might be: if we found the key then we return the translation otherwise we return the key, what in this last case will be the translated value itself ).

Re: Property group translation

PostPosted:Fri Jul 28, 2017 9:13 am
by Petr_Valenta

Thank you for a fast answer. If it is possible, please send me some clues about that.

Thanks a lot in advance.


Re: Property group translation

PostPosted:Sat Jul 29, 2017 10:15 am
by jllort
Let's use this property group as a sample:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.0//EN"
  <property-group label="Consulting" name="okg:consulting">
    <input label="Name" type="text" name=""/>
    <input label="Date" type="date" name="" />
    <checkbox label="" name="okp:consulting.important"/>
    <textarea label="" name="okp:consulting.comment"/>
I have combined labels with direct translation and labels with keys ( last 2, key.*.* ).
Should be added in translations the keys, for example in english ( same for other languages ):
Code: Select all
Then I suggest modify class, look for each time is called the method named getLabel() in this class ( really referenced a lot of times in serveral widgets, buttons, inputs, lists etc... ). I think the easiest is convert the code like :
Code: Select all
Button transButton = new Button(gWTButton.getLabel());
Code: Select all
Button transButton = new Button(Main.i18n(gWTButton.getLabel()));
If you take a look into the logic of method i18n you'll see if the translation for the key does not exist, it returns the key, than means:
- case try translation for term "Name" what not exist, name will be returned
- case try translation for term "" what exist, will be returned the translation.

As you can see there're a lot of getLabel() to be changed, but it's really easy change it and I think should going right. Keep us updated about if all has gone right and in case positive we can introduce by default into OpenKM code.

Re: Property group translation

PostPosted:Tue Aug 01, 2017 10:55 am
by Petr_Valenta
Thanks a lot. This works fine.

There is one small error - the name of the tab with properties is not translated. It is neccessary to add Main.i18n call into TabDocument

Code: Select all
final AsyncCallback<List<GWTPropertyGroup>> callbackGetGroups = new AsyncCallback<List<GWTPropertyGroup>>() {

		public void onSuccess(List<GWTPropertyGroup> result) {

			GWTFolder gwtFolder = Main.get().activeFolderTree.getFolder();
			boolean enableUpdatePropertyGroup = false;

			for (GWTPropertyGroup gwtGroup : result) {
				String groupTranslation = Main.i18n(gwtGroup.getLabel());
This issue can be closed.