推荐学习书目
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
aragakiiyui
V2EX  ›  Python

关于 flask 多语言版本的问题

  •  
  •   aragakiiyui · Mar 14, 2016 · 3101 views
    This topic created in 3755 days ago, the information mentioned may be changed or developed.

    大家好,我现在使用 pybabel 插件来做英文版和繁体版本的页面。然后我照着官方文档处理好了要翻译的对应内容。运行的时候,在 windows 环境下测试完全没问题。都翻译的好好的。但是一旦丢到 linux 服务器( Centos )上。就翻译不完整。只有少部分内容是正确的。请问各位又遇到过吗,有可能是哪里的问题?!

    5 replies    2016-03-15 09:26:16 +08:00
    Kilerd
        1
    Kilerd  
       Mar 14, 2016
    flask-babel 一般不都是用这个嘛?
    aragakiiyui
        2
    aragakiiyui  
    OP
       Mar 14, 2016
    @Kilerd 我用的是 flask-babel ..pybabel 是他内置的指令而已。。
    namco1992
        3
    namco1992  
       Mar 14, 2016
    这还真没见过...我前一段时间刚刚弄过,无论是 ubuntu 、 os x 还是 windows 都跑过,没有出现这种问题啊,你每次的步骤有问题吗?提取文本 -> update -> 翻译文本 -> 编译,是这个步骤吗?
    aragakiiyui
        4
    aragakiiyui  
    OP
       Mar 15, 2016
    @namco1992
    @Kilerd 没问题了。我改了 CentOS 上面 gettext 的源码。我在 windows 上面测,默认是 unicode ,但是 linux 上面是 str ,我把源码的 str 改成 unicode 就好了~
    namco1992
        5
    namco1992  
       Mar 15, 2016
    嗯, 2.7 ,没办法,把所有的字符串都带上 u 吧,防患于未然
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5342 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 59ms · UTC 08:20 · PVG 16:20 · LAX 01:20 · JFK 04:20
    ♥ Do have faith in what you're doing.