summaryrefslogtreecommitdiff
path: root/docs/LANGUAGE
blob: 00e00c111822292c1273d316c0288a2daf090713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 install the locales-all package.

    On Ubuntu run locale-gen for each language you want to enable.
        For example:
        locale-gen es_ES.UTF-8

        Then execute:
        dpkg-reconfigure locales

    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.txt

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 0x1A 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
    or send it to team@anope.org (don't forget to mention clearly your (nick)name, your email and the language name).
    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.