How to make python's argparse generate Non-English text?

前端 未结 5 790
星月不相逢
星月不相逢 2020-12-31 12:50

The argparse module \"automatically generates help and usage messages\". I can give Non-English names to the arguments and provide Non-English help texts; b

5条回答
  •  被撕碎了的回忆
    2020-12-31 13:33

    I was faced with a similar problem. Almost all messages will translated properly doing as described in post 5, but not the help messages added with parser.add_argument(). You can solve the problem by using non-class-based gettext for argparse and class-based gettext for the app. Have a look at app3.py in https://github.com/jmo3300/py01_i18n_01

提交回复
热议问题