Manual:Pywikibot/i18n

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

For users
I18n submodule is vital for running bots. It doesn't matter if you want to run pywikibot in an English-based wiki or not.

If you want to install it you can run the following commands:

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

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

scripts --> i18n --> category --> fa.json

Changing or adding i18n
If you wish to change or add i18n for certain script in your language, use and update your i18n submodule after one week or two.

In order to update i18n submodule run the following commands:

or in root run:

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

For developers
I18n class is in i18n.py in pywikibot folder, the related documents can be found in [https://doc.wikimedia.org/pywikibot/api_ref/pywikibot.html#module-pywikibot.i18n the documentation].

As an easy example:

You can give a site object instead of language code: