Table of contents
As described in plugins documentation, Citellus can make use of translated strings.
$"Whatever"in bash scripts
_("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.
pipsi is not installed, run first
pip install pipsi.
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:
citellus.potwith the new strings
- While your older translation is open, select from the
Update from POT file, and then select
- The new strings will appear in your editor, remember to
citellus.pofor your language and the compiled
- Remember to add those files to the repo in your commit if you want others to take advantage of it.
citellus.py --lang $LANGto test it