Why some translation not shown up in Django app

While I dev some django app, I follow the standard procedure to generate the message.po file

python djang-admin.py makemessages -l zh_CN

I tried compile it and restart httpd to clear the django translation cache, but some text still not shown up correctly with the translated text, at the first galance, I think this may be some translation issue, tried many ways to disable gettext/django translation cache, still no luck. Then I checked the comiled .mo files, it seems doesn’t contain the translated key,

strings /path/to/trasnlated.mo | grep 

I found that all missed translation text all have ", Fuzzy’ attribute in .po file,
by google searching, the ‘Fuzzy’ attribute indicates the text translation will be skipped, oops, that’s the reason.

  • What “fuzzy” means – python, django, gettext.

    A django application is in process of adding support for second language.
    During adding translations to the django.po file after next .po file compilation some of previously translated texts were displayed on target site in their original, untranslated form.
    “#, fuzzy” flag was responsible for not translating my strings.
    Fuzzy flag description. In short words: if you are sure that “fuzzy” marked translation is correct simply remove “fuzzy” flag, compile the .po file and you are done.
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇