feat(docs): localize documentation to Russian and update Makefile for Sphinx

This commit is contained in:
deesiigneer
2026-01-17 19:02:11 +00:00
parent 4fc530caeb
commit 6da906e0d1
5 changed files with 65 additions and 79 deletions

View File

@@ -5,8 +5,8 @@
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:

View File

@@ -1,25 +1,25 @@
.. currentmodule:: pyspapi
API Reference
Справочник API
===============
The following section outlines the API of pyspapi.
В следующем разделе описывается API pyspapi.
Version Info
Информация о версии
---------------------
There are two main ways to query version information.
Существует два основных способа запроса информации о версии.
.. data:: version_info
A named tuple that is similar to :obj:`py:sys.version_info`.
Именованный кортеж, аналогичный :obj:`py:sys.version_info`.
Just like :obj:`py:sys.version_info` the valid values for ``releaselevel`` are
'alpha', 'beta', 'candidate' and 'final'.
Как и в :obj:`py:sys.version_info`, допустимые значения для ``releaselevel`` это
'alpha', 'beta', 'candidate' и 'final'.
.. data:: __version__
A string representation of the version.
Строковое представление версии.
``pyspapi``
-----------

View File

@@ -1,59 +1,44 @@
from re import search, MULTILINE
from importlib.metadata import version as pkg_version
import os
import sys
project = "pyspapi"
author = "deesiigneer"
copyright = "2022, deesiigneer"
project = 'pyspapi'
copyright = '2022, deesiigneer'
author = 'deesiigneer'
with open("../pyspapi/__init__.py") as f:
match = search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), MULTILINE)
if not match or match.group(1) is None:
raise RuntimeError("The version could not be resolved")
version = match.group(1)
# The full version, including alpha/beta/rc tags.
version = pkg_version("pyspapi")
release = version
# -- General configuration
sys.path.insert(0, os.path.abspath(".."))
extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
"sphinx.ext.duration",
"sphinx.ext.doctest",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
]
autodoc_member_order = "bysource"
autodoc_typehinta = "none"
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
}
autosummary_generate = True
version_match = os.environ.get("READTHEDOCS_VERSION")
json_url = f"https://pyspapi.readthedocs.io/ru/{version_match}/_static/switcher.json"
intersphinx_disabled_domains = ['std']
language = 'en'
locale_dirs = ["locale/"]
language = "ru"
exclude_patterns = []
html_static_path = ["_static"]
html_theme = "pydata_sphinx_theme"
html_logo = "./images/logo.png"
html_favicon = "./images/logo.ico"
html_theme_options = {
"external_links": [
{
"url": "https://github.com/deesiigneer/pyspapi/releases",
"name": "Changelog",
},
{
"url": "https://github.com/sp-worlds/api-docs/wiki",
"name": "SPWorlds API Docs",
}
],
"icon_links": [
@@ -61,24 +46,27 @@ html_theme_options = {
"name": "GitHub",
"url": "https://github.com/deesiigneer/pyspapi",
"icon": "fab fa-brands fa-github",
"type": "fontawesome"
"type": "fontawesome",
},
{
"name": "Discord",
"url": "https://discord.gg/VbyHaKRAaN",
"icon": "fab fa-brands fa-discord",
"type": "fontawesome"
"type": "fontawesome",
},
{
"name": "PyPi",
"name": "PyPI",
"url": "https://pypi.org/project/pyspapi/",
"icon": "fab fa-brands fa-python",
"type": "fontawesome"
}
"type": "fontawesome",
},
],
"header_links_before_dropdown": 4,
"show_toc_level": 1,
"navbar_start": ["navbar-logo"],
"navigation_with_keys": True,
"switcher": {
"json_url": json_url,
"version_match": version_match,
},
}
html_css_files = ["custom.css"]

View File

@@ -1,32 +1,31 @@
:theme_html_remove_secondary_sidebar:
Welcome to pyspapi
===================
Добро пожаловать в pyspapi
===========================
API wrapper for SP servers written in Python.
Обертка API для SPWorlds серверов, написанная на Python.
Getting started
Начало работы
---------------
Is this your first time using the library? This is the place to get started!
Вы впервые используете библиотеку? Это место, с которого нужно начать!
- **First steps:** :ref:`Quickstart <quickstart>`
- **Examples:** Many examples are available in the `examples directory <https://github.com/deesiigneer/pyspapi/tree/main/examples/>`_.
- **Первые шаги:** :ref:`Быстрый старт <quickstart>`
- **Примеры:** Много примеров доступно в `папке примеров <https://github.com/deesiigneer/pyspapi/tree/main/examples/>`_.
Getting help
------------
Получение помощи
------------------
If you're having trouble with something, these resources might help.
Если у вас есть проблемы с чем-то, эти ресурсы могут помочь.
- Ask questions in `Discord <https://discord.gg/VbyHaKRAaN>`_ server.
- If you're looking for something specific, try the :ref:`searching <search>`.
- Report bugs in the `issue tracker <https://github.com/deesiigneer/pyspapi/issues>`_.
- Ask in `GitHub discussions page <https://github.com/deesiigneer/pyspapi/discussions>`_.
- Задавайте вопросы на сервере `Discord <https://discord.gg/VbyHaKRAaN>`_.
- Если вы ищете что-то конкретное, попробуйте :ref:`поиск <search>`.
- Сообщайте об ошибках в `трекер проблем <https://github.com/deesiigneer/pyspapi/issues>`_.
Manuals
-------
Руководства
-----------
These pages go into great detail about everything the API can do.
Эти страницы подробно описывают все, что может сделать API.
.. toctree::
:maxdepth: 1

View File

@@ -4,17 +4,17 @@
.. currentmodule:: pyspapi
Quickstart
==========
Быстрый старт
==============
This page gives a brief introduction to the library.
На этой странице дается краткое введение в библиотеку.
Checking balance
----------------
Проверка баланса
-----------------
Let's output the amount of money remaining in the card account to the console.
Выведем количество денег, оставшихся на счету карты, на консоль.
It looks something like this:
Это выглядит примерно так:
.. code-block:: python
@@ -30,7 +30,6 @@ It looks something like this:
loop = get_event_loop()
loop.run_until_complete(main())
Make sure not to name it ``pyspapi`` as that'll conflict with the library.
Убедитесь, что вы не называете его ``pyspapi``, так как это вызовет конфликт с библиотекой.
You can find more examples in the `examples directory <https://github.com/deesiigneer/pyspapi/tree/main/examples/>`_ on GitHub.
Вы можете найти больше примеров в `папке примеров <https://github.com/deesiigneer/pyspapi/tree/main/examples/>`_ на GitHub.