mirror of
https://github.com/anope/anope.git
synced 2026-06-12 15:44:46 +02:00
64 lines
3.2 KiB
Plaintext
64 lines
3.2 KiB
Plaintext
Anope Multi Language Support
|
|
----------------------------
|
|
|
|
1) Building Anope with gettext support
|
|
2) Adding a new language
|
|
3) Using languages with modules
|
|
4) Updating a language file
|
|
|
|
1) Building Anope with gettext support
|
|
|
|
To build Anope with gettext support, gettext and its development libraries must be installed on the system.
|
|
|
|
On Debian-based systems install the locales-all package.
|
|
|
|
On RHEL-based systems run `yum list glibc-langpack-*` and install the languages you want to enable.
|
|
|
|
If you have already built Anope you will need to delete the build directory and rebuild from scratch.
|
|
|
|
Building Anope on Windows with gettext support is explained in docs/WIN32.md
|
|
|
|
2) Adding a new language
|
|
|
|
Anope uses gettext (https://www.gnu.org/software/gettext/) to translate messages for users. To add a new language
|
|
install gettext and run `msginit -l language -o anope.language.po -i anope.pot`. For example if I was translating to
|
|
Spanish I could run `msginit -l es_ES -o anope.es_ES.po -i anope.pot`. Open the newly generating .po file and start
|
|
translating. Once you are done simply rerun ./Config; make && make install and add the language to your anope.conf.
|
|
|
|
Poedit (https://poedit.net/) is a popular po file editor, and we recommend using it or another editor designed to edit
|
|
po files (especially on Windows).
|
|
|
|
There are several control characters within the messages. These are mostly IRC formatting codes (https://modern.ircdocs.horse/formatting)
|
|
but 0x1B is special to Anope and is used to prevent the automatic linewrapper from breaking messages in the middle of
|
|
text that should not be split (e.g. commands). Your editor may not show these so be careful you don't delete them!
|
|
|
|
If you have finished a language file translation and you want others to use it, please file a pull request on GitHub.
|
|
You'll of course get full credit for it.
|
|
|
|
3) Using languages with modules
|
|
|
|
Module authors can easily add the ability to have their modules translated by adding _() around the strings they
|
|
want translated (messages to the user, etc).
|
|
|
|
If you want to translate a module someone has made, first generate a .pot file if there isn't one already using
|
|
`xgettext -s -d modulename -o modulename.pot --from-code=utf-8 --keyword --keyword=_ modulename.cpp`.
|
|
The .pot file is a template of all of the language strings extracted from the source file.
|
|
|
|
Next, run msginit on the .pot file with
|
|
`msginit -l language -o modulename.language.po -i modulename.pot`.
|
|
Translate the new .po file and rerun ./Config; make && make install.
|
|
|
|
All .po and .pot files should be placed in modules/third/language. Additionally an update script is provided there
|
|
that will create .pot files and merge any changes to it with existing .po files.
|
|
|
|
4) Updating a language file
|
|
|
|
Poedit (https://poedit.net/) is a popular po file editor, and we recommend using it or another editor designed to edit
|
|
po files (especially on Windows).
|
|
|
|
Before editing the relevant file in languages/, run `update.sh` in the languages/ folder, i.e. `cd` to it and run
|
|
./update.sh
|
|
This will update the language file to contain all strings that need a translation.
|
|
|
|
Then commit only the changed .po files in git.
|