-
Notifications
You must be signed in to change notification settings - Fork 0
I18nDocumentation
TWiki>
LibrePlan localization files are uploaded to Transifex, you can directly translate there the different files.
LibrePlan uses GNU gettext tools to support internationalization, which means that translators will just need to take care of .po
files.
There are 2 keys.pot
files in LibrePlan:
ganttzk/src/main/resources/i18n/keys.pot
libreplan-webapp/src/main/resources/i18n/keys.pot
English
en
Default language
Czech
cs
Zbyněk Schwarz
Spanish
es
Jacobo Aragunde Pérez, Manuel Rego Casasnovas, Diego Pino García
French
fr
Stephane Ayache, Guillaume Postaire, Philippe Poumaroux
Galician
gl
Jacobo Aragunde Pérez, Manuel Rego Casasnovas, Diego Pino García
Italian
it
Giuseppe Zizza
Dutch
nl
Jeroen Baten
Polish
pl
Krzysztof Kamecki
Portuguese
pt
Lena Grosso, Joaquim Rocha
Russian
ru
Pavel Rudensky
h
Stands for hour
unl
Stands for unlimited
en
Stands for English, which needs to be translated into destination code (see table above) for generating help links
userDn
Stands for User domain name on LDAP preferences
Inh
Stands for Inherited
Op
Stands for operations which is usually displayed as the last column in the grid with edit, delete, etc. buttons
Planning points
F
Stands for Fully scheduled
P
Stands for Partially scheduled
U
Stands for Unscheduled
Earned Value Chart
BCWS
Budgeted Cost Work Scheduled
ACWP
Actual Cost Work Performed
BCWP
Budgeted Cost Work Performed
CV
Cost Variance
SV
Schedule Variance
BAC
Budget At Completion
EAC
Estimate At Completion
VAC
Variance At Completion
ETC
Estimate To Complete
CPI
Cost Performance Index
SPI
Schedule Performance Index
-
Get LibrePlan code from Git repository.
$ git clone git://github.com/Igalia/libreplan.git $ cd libreplan/
-
Go to folder
ganttzk/src/main/resources/i18n/
.$ cd ganttzk/src/main/resources/i18n/
-
Update
.po
file. For example:$ msgmerge -U es.po keys.pot
-
Review
.po
file translation using a text editor or a specific translation tool like Gtranslator or Lokalize.$ gtranslator es.po
-
Do the same for folder
libreplan-webapp/src/main/resources/i18n/
.$ cd ../../../../../libreplan-webapp/src/main/resources/i18n/ $ msgmerge -U es.po keys.pot $ gtranslator es.po
-
In order to update LibrePlan reports translations go to
libreplan-webapp/src/main/jasper/
folder.$ cd ../../../../../libreplan-webapp/src/main/jasper/
-
Review folders with
_Bundle
suffix and update.properties
files for your language. -
Send the new files or a patch to us.
-
Get LibrePlan code from Git repository.
$ git clone git://github.com/Igalia/libreplan.git $ cd libreplan/
-
Go to folder
ganttzk/src/main/resources/i18n/
.$ cd ganttzk/src/main/resources/i18n/
-
Generate new
.po
file. For example:$ msginit -i keys.pot -o fr.po
-
Translate new
.po
file using a text editor or a specific translation tool like Gtranslator.$ gtranslator fr.po
-
Do the same for folder
libreplan-webapp/src/main/resources/i18n/
.$ cd ../../../../../libreplan-webapp/src/main/resources/i18n/ $ msginit -i keys.pot -o fr.po $ gtranslator fr.po
-
In order to translate LibrePlan reports go to
libreplan-webapp/src/main/jasper/
folder.$ cd ../../../../../libreplan-webapp/src/main/jasper/
-
Review folders with
_Bundle
suffix and create new.properties
files for your language. -
Send the new files or a patch to us.
-
Go to scripts folder
scripts/
.$ cd scripts/
-
Execute
libreplan-all-keys-generator.sh
script:$ ./libreplan-all-keys-generator.sh
-
Review changes done in
keys.pot
files to check that everything is right:-
Avoid addition of empty strings.
msgid "" msgstr ""
-
Keep header and copyright information right.
-
-
Push changes.
-
Import
I18nHelper
class depending on module:import static org.libreplan.web.I18nHelper._;
or
import static org.libreplan.business.i18n.I18nHelper._;
or
import static org.zkoss.ganttz.i18n.I18nHelper._;
-
Call
_(String str)
method:_("my string");
or with parameters
_("Project {0} saved", projectName);
-
Add taglib (optional):
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n" ?>
This tablib is already added in file
template.zul
which is usually used in most of.zul
pages, so this step is not always needed. -
Call
i18n:_(String str)
method:<button label="${i18n:_('Add')}" />
or with parameters
<i18n value="Confirm deleting {0} ?" arg0="@{controller.worker.name}">
or
<window title="${i18n:__('Error: {0}', requestScope['javax.servlet.error.status_code'])}">
-
Import GanttZK.I18nHelper and set prefix as
ganttzk_i18n
:<?xel-method prefix="ganttzk_i18n" name="_" class="org.zkoss.ganttz.i18n.I18nHelper" signature="java.lang.String _(java.lang.String name)" ?>
-
Call
ganttzk_i18n:_(String str)
method:<button label="${ganttzk_i18n:_('Add')}" />
NOTE: Currently localization of strings with parameters is not supported in ganttzk.
Reports are localized in the same fashion Jasper Reports are localized. Briefing, there's a XXX.properties
file for each localized language.
- Create a new report or edit an existing one with iReport. Once opened, click on it to see its properties. In the property Resource Bundle set the name of the folder which will contain your
XXX.properties
files. - Create a new folder for storing the
XXX.properties
files. The folder must end with suffix_Bundle
. - Create your
XXX.properties
file, one for each language you would like to support. The format of each file should be:XXX_lang_country
. For instance:hoursWorkedPerWorker_en_US.properties
(lang: en; country: US). In general, it's a good idea to also have a plainXXX.properties
(without lang and country), for being used as default.
In case of doubt, check folder libreplan-webapp/src/main/jasper/
for examples.
If your Enum is in the webapp layer, mark the literals you would like to translate with _(). Example:
public enum ProgressType {
SPREAD_PROGRESS(_("Progress with all task tasks by hours")),
CRITICAL_PATH_DURATION(_("Progress with critical path tasks by hours")),
CRITICAL_PATH_NUMHOURS(_("Progress with critical path tasks by duration"));
private String value;
}
It's a good idea to implement toString()
and return value
.
public String toString() {
return value;
}
If your Enum is in the business layer, do the same as in the previous case, however this is not enough.
The _() from the business layer is a fake function, it does nothing. It's only used to mark the texts you would like to translate, but the function that really does the translation is the _() function from the webapp layer. That means that apart from marking the texts in the business layer you also need to filter those values through a _() function in the webapp layer.
A common source of error is marking the literal in the business layer but retrieving those values in the webapp directly, using a zul component and a model attribute for instance.
<listbox id="lbTypeProgress"
model="@{configurationController.progressTypes}"
selectedItem="@{configurationController.selectedProgressType}"
mold="select" />
In cases like this you'd need to implement a controller that explicitly filters the literal you need to translate.
public ProgressTypeRenderer getProgressTypeRenderer() {
return progressTypeRenderer;
}
private class ProgressTypeRenderer implements ListitemRenderer {
@Override
public void render(Listitem item, Object data) throws Exception {
ProgressType progressType = (ProgressType) data;
item.setLabel(_(progressType.getValue()));
}
}
And now use the renderer in your component
itemRenderer="@{configurationController.progressTypeRenderer}"
Copyright (c) by the contributing authors. All material on this collaboration platform is the property of the contributing authors.