• Property group translation

  • Help us to spread the OpenKM word translating the applicacion to your preferrd language.
Help us to spread the OpenKM word translating the applicacion to your preferrd language.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #44429  by Petr_Valenta
 
Hello

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.

Petr
 #44436  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 ).
 #44444  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"
                                 "http://www.openkm.com/dtd/property-groups-2.0.dtd">
<property-groups>
  <property-group label="Consulting" name="okg:consulting">
    <input label="Name" type="text" name="okp:consulting.name"/>
    <input label="Date" type="date" name="okp:consulting.date" />
    <checkbox label="key.consulting.important" name="okp:consulting.important"/>
    <textarea label="key.consulting.comment" name="okp:consulting.comment"/>
  </property-group>
</property-groups>
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
INSERT INTO OKM_TRANSLATION (TR_MODULE, TR_KEY, TR_TEXT, TR_LANGUAGE) VALUES ('frontend', 'key.consulting.important', 'Important', 'en-GB');
INSERT INTO OKM_TRANSLATION (TR_MODULE, TR_KEY, TR_TEXT, TR_LANGUAGE) VALUES ('frontend', 'key.consulting.comment', 'Comment', 'en-GB');
Then I suggest modify class FormManager.java, 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());
into
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 "key.consulting.comment" 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.
 #44459  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.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.