1.2 KiB
1.2 KiB
Translation with gettext
As a developer
Extract messages to be translated from the source files and into a Portable Object Template file:
xgettext --from-code=UTF-8 --no-wrap -d messages -p locales/ *.php */*.php */*/*.php
mv locales/messages.po locales/messages.pot
Merge messages into existing Portable Objects:
msgmerge --no-wrap locales/fr/C/LC_MESSAGES/messages.po locales/messages.pot -o locales/fr/C/LC_MESSAGES/messages.po
As a translator
To start a new translation
mkdir -p locales/fr/C/LC_MESSAGES/
msginit -i locales/messages.pot -o locales/fr/C/LC_MESSAGES/messages.po
To translate
Edit locales/fr/C/LC_MESSAGES/messages.po
using either
- any text editor
- dedicated translation software like Poedit, KDE's Lokalize or GNOME Translation Editor.
As an administrator
To compile Portable Objects into Machine Objects:
msgfmt locales/fr/C/LC_MESSAGES/messages.po -o locales/fr/C/LC_MESSAGES/messages.mo
Machine Objects files are kept in cache by the Gettext extension, so PHP-FPM needs to be restarted to update translations.