Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python argparse 库翻译

Python 标准库 argparse 的非官方翻译项目。

想要贡献?请阅读 贡献指北

使用

将仓库中的翻译目录放到你的程序下,然后在你的程序中添加下面这些代码:

import argparse
import gettext
import locale

_lang = locale.getdefaultlocale()[0] or "zh-CN"  # https://github.com/python/cpython/issues/130796 pylint: disable=deprecated-method / W4902
# 这里设置 zh-CN 为默认语言

t = gettext.translation(
    "argparse", "locale", [_lang]
)  # 修改 "locale" 为你存放翻译文件的位置
argparse._ = t.gettext  # pyright: ignore[reportAttributeAccessIssue]
argparse.ngettext = t.ngettext  # pyright: ignore[reportAttributeAccessIssue]

许可

本项目采用 CC0 1.0 UniversalCC 标志CC 0 标志 许可协议。

About

Unofficial translation project for the Python standard library module argparse. / Python 标准库 argparse 的非官方翻译项目。

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages