Translations ============ The OTR bot supports translations made with Gettext. The translation files are placed in the ``otrbot/locales/`` directories. The otrbot comes with four commands that help you setup new translations and update existing ones. run ``./bot -h`` to get an overview of the commands. Each subcommand also supports help, so when in doubt, just try ``./bot.py -h`` Extracting translation messages ------------------------------- When the otr bot's messages have been altered, or new ones have been added, the command ``./bot extract`` will extract these new messages from the program code. This generates a new ``.pot`` file (``messages.pot`` by default) that can be used to update the current translations. If you want the ``.pot`` file to have another name, supply that name with the ``-o`` flag. Starting a translation ---------------------- To start a translation, you use the ``init`` subcommand. When you run ``./bot init ``, a new locale will be created in the ``otrbot/locales`` directory. So, let's say you want to start an en_US translation and you extracted the translations to ``messages.pot``, run ``./bot init messages.pot en_US``. Updating an existing translation -------------------------------- When you have an updated ``.pot`` file, because the application changed, you can update your translation files by running ``./bot update ``. If you used the default filename (``messages.pot``) for extraction and, for example, want to update your en_US translation, you run ``./bot update messages.pot en_US``. The program will notify you of which file it created. You can then edit that file with your favorite editor. Compiling your changes ---------------------- When you are happy with your changes, you should compile the new messages to a messages.mo file, a binary file that can be read quickly by the computer. To compile your locale files, run ``./bot compile``. This automatically compiles all the locales in the ``otrbot/locales`` directory. If you only want to compile one of the locales, you can use the ``-l`` flag. For example, to only compile your en_GB translation, run ``./bot compile -l en_US``.