mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
* ✨ 支持 i18n #410 * 🚨 更改noqa方式 * 📝 添加 CONTRIBUTING.md 文件 * 🌐 将 i18n 默认语言设置为 en-US * 📝 添加英文版 CONTRIBUTING.md
2.6 KiB
2.6 KiB
How to Contribute?
Setting Up the Environment
For Developers with Basic Python Knowledge
First, you need Python 3.10 and Poetry.
Then, you need to clone this repository to your local machine using the git clone command, and install dependencies using poetry install --sync.
For Developers with Limited Python Knowledge
Here are my recommended best practices:
# Install uv
# Please refer to https://docs.astral.sh/uv/getting-started/installation/
# Set up the basic Python environment
uv python install 3.10
uv tool install poetry
# Clone the repository
git clone https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
cd nonebot-plugin-tetris-stats
# Install dependencies
uv run --no-project --python 3.10 poetry env use python
poetry install --sync
Development
Code Development
- For static code analysis, use ruff. You can install the corresponding plugin for your IDE or use the command line with
ruff check ./nonebot_plugin_tetris_stats/to check the code. - For code formatting, use ruff. You can install the corresponding plugin for your IDE or use the command line with
ruff format ./nonebot_plugin_tetris_stats/to format the code. - For type checking, use both basedpyright and mypy. You can install the corresponding plugins for your IDE or use the following commands in the terminal to check the code:
# basedpyright
basedpyright ./nonebot_plugin_tetris_stats/
# mypy
mypy ./nonebot_plugin_tetris_stats/
Internationalization
This project uses Tarina for internationalization support.
Adding a New Language
- Navigate to the
./nonebot_plugin_tetris_stats/i18n/directory. - Run
tarina-lang create {language_code}* Please note that the language code should preferably follow the IETF language tag standard. - Edit the generated
./nonebot_plugin_tetris_stats/i18n/{language_code}.jsonfile.
Updating an Existing Language
- Navigate to the
./nonebot_plugin_tetris_stats/i18n/directory. - Edit the corresponding
./nonebot_plugin_tetris_stats/i18n/{language_code}.jsonfile.
Adding New Entries
- Navigate to the
./nonebot_plugin_tetris_stats/i18n/directory. - Edit the
.template.jsonfile. - Run
tarina-lang schema && tarina-lang model. - Modify the language files, adding new entries at least to
en-US.json.