推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
mzmxcvbn
V2EX  ›  Python

国际化 flask-babel,是只能用 _ 吗

  •  
  •   mzmxcvbn · Jun 27, 2019 · 2641 views
    This topic created in 2663 days ago, the information mentioned may be changed or developed.
    为了简便,需要翻译的文本一般用
    from flask_babel import gettext as _
    _('hello)
    来提取,

    但我代码里用到 _ 来充当之后不用的变量了,所以会冲突,我就用了
    from flask_babel import gettext as _g
    _g('hello)
    但是发现,这样
    pybabel extract
    就探测不到文本了。这是啥情况,是只能用 _ 吗,有什么方法能解决,直接用 gettext 太丑了
    2 replies  •  2019-07-01 10:01:53 +08:00
    sunhk25
        1
    sunhk25  
       Jun 27, 2019 via Android
    最近在学习 flask,同样感兴趣
    mzmxcvbn
        2
    mzmxcvbn  
    OP
       Jul 1, 2019
    有大神能解答一下吗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2722 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 00:02 · PVG 08:02 · LAX 17:02 · JFK 20:02
    ♥ Do have faith in what you're doing.