Django 1.5.5 displays original (en) strings always (does not translate)

前端 未结 1 1867
生来不讨喜
生来不讨喜 2020-12-12 01:00

I\'m trying to implement simple Django 1.5.5 string translation in templates.

I have:

  1. USE_I18N = True in settings.py
相关标签:
1条回答
  • 2020-12-12 01:16

    Answer (updated from comment):

    It seems like a path issue (or else you'd see some error).

    Try doing something like this in your settings:

    
    import os
    PROJECT_PATH = os.path.abspath(os.path.dirname(__file__)) 
    
    LOCALE_PATHS = ( os.path.join(PROJECT_PATH, '../locale'), ) 
    print LOCALE_PATHS
    
    

    to be totally sure that you've the correct path.

    Also don't forget that you need to have the path locale/he/LC_MESSAGES/ that will contain your django.mo (and po) file.

    0 讨论(0)
提交回复
热议问题