Weblate 源代码#

Weblate 在 GitHub 上开发。欢迎您将代码复刻并开一个拉取请求。同样欢迎任何形式的补丁。

参见

查阅 Weblate 内部 来看看 Weblate 内部是什么样子的。

代码编写准则#

在为 Weblate 编写任何代码时都应该考虑到 通过设计保证安全原则

任何代码都应附带解释行为的文档。不要忘记记录方法、复杂的代码块或用户可见的功能。

任何新代码都应使用 PEP 484 类型提示。我们尚未在 CI 中检查此项,因为现有代码尚未包含它们。

编码标准和代码检查#

代码应该遵循 PEP-8 代码编写准则,并且应该使用 ruff 代码格式化程序进行代码格式化。

要检查代码质量,你可以使用 ruff,其配置存储在 pyproject.toml 中。

The easiest approach to enforce all this is to install pre-commit. The repository contains configuration for it to verify the committed files are sane. After installing it (it is already included in the pyproject.toml) turn it on by running pre-commit install in Weblate checkout. This way all your changes will be automatically checked.

还能够手动触发检查,来检查所有文件的运行:

pre-commit run --all