Посібник:Pywikibot/i18n

From mediawiki.org
This page is a translated version of the page Manual:Pywikibot/i18n and the translation is 39% complete.

Ця сторінка призначена для того, щоб допомогти вам зрозуміти систему i18n у pywikibot.

Для користувачів

Підмодуль I18n життєво важливий для запуску ботів. Неважливо, чи хочете ви запускати pywikibot в англомовній вікі, чи ні. Якщо ви хочете встановити його, ви можете виконати такі команди:

$ 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 class is in i18n.py in pywikibot folder, the related documents can be found in the documentation. As an easy example:

>>> 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 είναι καλό άρθρο


Якщо вам потрібна додаткова допомога щодо налаштування вашого Pywikibot, відвідайте #pywikibot IRC-канал connect або pywikibot@ список розсилки.