# Translating `rmlint`

Rudimentary support for internationalization is provided via `gettext`. Also see this Issue for a list of translators, current translations and a wish-list of new translations.

## Adding new languages

    # Fork a new .po file from the po-template (here swedish):
    $ msginit -i po/rmlint.pot -o po/se.po --locale se --no-translator

    # Edit the po/se.po file, the format is self describing
    $ vim po/se.po

    # .po files need to be compiled, but that's handled by scons already.
    $ scons
    $ scons install

    # You should see your changes now:
    $ LANG=se ./rmlint

If you’d like to contribute your new translation you want to do a pull request (if you really dislike that, you may also send the translation to us via mail). Here is a small introduction on Pull Requests.

## Updating existing languages

    # Edit the file to your needs:
    $ vim po/xy.po

    # Install:
    $ scons install

    # Done
    $ LANG=xy ./rmlint

## Marking new strings for translations

If you want to mark strings in the C-code to be translated, you gonna need to mark them so the `xgettext` can find it. The latter tool goes through the source and creates a template file with all translations left out.

    /* Mark the string with the _() macro */
    fprintf(out, _("Stuff is alright: %s\n"), (alright) ? "yes" : "no");

It gets a little harder when static strings need to be marked, since they cannot be translated during compile time. You have to mark them first and translate them at a later point:

    static const char * stuff = _N("Hello World");

    void print_world(void) {
        printf("World is %s\n", _(stuff));
    }

After you’re done with marking the new strings, you have to update the gettext files:

    $ scons gettext

Then, proceed to work with the relevant `*.po` file as described above.