Manual:Pywikibot/i18n

This page is dedicated to help you understand i18n system in pywikibot.

For users
I18n submodule is vital for running bots, It doesn't matter if you want to run pywikibot in a English-based wiki or not. In core i18n files exist in scripts folder and in compat they can be found in root folder (i18n folder). So If you want to install it you should do:

Note: If you cloned pywikibot with  option or you downloaded nightly, i18n submodule is already there and no need to install anything.

I18n files are json files in i18n folder separated by language and script e.g. Persian i18n phrases related to category.py exist in:

Changing or adding i18n
If you wish to change or add i18n for certain script in your language, Use Translatewiki and update your i18n submodule after one week or two. In order to update i18n you need to command: or in root run:

If you can't wait change it manually but we don't recommend since it may cause failure in next updates.

For developers
I18n class is in i18n.py in pywikibot folder (both core and compat), the related documents can be found in the files. As an easy example:

You can give a site object instead of language code: