Jump to content

手冊:Pywikibot/i18n

From mediawiki.org
This page is a translated version of the page Manual:Pywikibot/i18n and the translation is 33% complete.
Outdated translations are marked like this.

呢版係用嚟令你更加明pywikibot入面嘅Template:$localisation系統。

對於wiki用戶

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:

$ cd scripts
$ git clone https://gerrit.wikimedia.org/r/pywikibot/i18n.git
If you cloned pywikibot with --recursive option or downloaded nightly, i18n submodule is already there and there is no need to install anything.

With SVN submodule must be always configured and updated separately using:

$ cd scripts
$ svn co https://github.com/wikimedia/pywikibot-i18n/trunk i18n

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

改或者加i18n

If you wish to change or add i18n for certain script in your language, use translatewiki.net and update your i18n submodule after one week or two. In order to update i18n submodule run the following commands:

$ cd scripts
$ cd i18n
$ git pull

or in root run:

$ git pull --recurse-submodules

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

畀開發人

I18n類係喺pywikibot快勞入邊嘅i18n.py度,同呢個類有拏褦嘅文件可以喺the documentation度搵到。 舉個簡單嘅例

>>> from pywikibot import i18n
>>> print(i18n.twtranslate('es', 'pywikibot-enter-new-text'))
Escribe el nuevo texto:
>>> print(i18n.twtranslate('arz', 'featured-good'))
بوت: %(page)s هي مقالة جيدة # Since arz translation doesn't exist, it returned ar i18n

You can give a site object instead of language code:

>>> import pywikibot
>>> print(pywikibot.i18n.twtranslate(pywikibot.Site('el'), 'featured-good'))
Ρομπότ: το %(page)s είναι καλό άρθρο


If you need more help on setting up your Pywikibot visit the #pywikibot IRC channel connect or pywikibot@ mailing list.