-
Notifications
You must be signed in to change notification settings - Fork 34
Translation
The website is translated using gettext
. By default, all strings are written
in English.
In the code, string should be translated with the translator, which can be
obtained with the ServiceManager
. Then, strings should be translated as
follows:
<?php
// obtain the translator
$translator = $sm->get('translator');
echo $translator->translate('Some text');
Most translation actually happens in views. Thus, there is a translate view
helper to help translation in views along. In views, you don't have to worry
about translator setup, you can simply use $this->translate()
to translate
strings.
In the main directory of the project, there is a translate-helper
shell
script. If the script is executed, all strings which are translated by the
translator, will be gathered in module/Application/language/gewisweb.pot
.
From here, the language files (which are located in
module/Application/language/
) are automatically updated by running msgmerge lang.po gewisweb.pot
. (done by shell script as well). This updates the existing language file with newly added
strings.
The translation files en.po
and nl.po
should be translated with an editor
like POEdit. When saved, these will be converted to the binary *.mo
files
used by the translator.
- Contributing
- Architecture
- Components
- View helpers
- Sub-projects
- Archive