Table of contents

  1. Extract strings
    1. What If... I don't have tox? or it's older?
  2. Editing the catalog with poedit

Extract strings

As described in plugins documentation, Citellus can make use of translated strings.

  • Strings like $"Whatever" in bash scripts

  • Strings with _("whatever") in python if language file has been installed

    # Import the _() function
    import gettext
    localedir = os.environ['TEXTDOMAINDIR']
    # This will use system defined LANGUAGE
    trad = gettext.translation('citellus', localedir, fallback=True)
    
    try:
        _ = trad.ugettext
    except AttributeError:
        _ = trad.gettext
    

In order to prepare them for translation, extractpot.sh script must be used.

It requires some dependencies to work, so easiest way is to run tox -e pep8 as tox takes care of preparing a virtual environment with prerequirements and run from there.

What If... I don't have tox? or it's older?

If your system version of tox is old, approach will be: - If you've pipsi installed, just run pipsi install tox to get a virtualized version of tox installed that you can use. - If pipsi is not installed, run first pip install pipsi. - If pip is not available, install your distribution python-pip package equivalent.

NOTE: Ensure that your local path (~/.local/bin) preceeds regular system path so that your shell uses first the files in the local venvs created by pipsi.

NOTE: Do not install anything else with pip as it can mess with your system-wide installed libraries and cause havoc on other programs.

Editing the catalog with poedit

Once you have decided to start a translation or to improve a new one, you must use the citellus.pot as 'base' for a new translation OR if you already have one created:

  • Open prior translation with poedit (so you can edit missing to translate strings)
  • If a plugin has introduced new strings, those will not appear on the file you're editting, so you'll need to update it:
    • Execute ./extractpot.sh to update citellus.pot with the new strings
    • While your older translation is open, select from the poedit menus: Catalog, then Update from POT file, and then select citellus.pot.
    • The new strings will appear in your editor, remember to save to create citellus.po for your language and the compiled citellus.mo.
    • Remember to add those files to the repo in your commit if you want others to take advantage of it.
    • Execute citellus.py --lang $LANG to test it