0

After the migration to the new django version from 1.2 I have found that my localization in templates does not work. I have tried to recompile *.mo files - it's seems that translation data have been right processed but it did not helped.

May be somebody know this issue? Or may be, somebody know how to discover it? I even don't know how to reconstruct django locale environment in shell script.

How can I receive something like this in shell:

>> import django.utils.translation
>> django.utils.translation.gettext("some text that exists in locale/de/LC_MESSAGES/django.po")
>> "translated text"
4

1 に答える 1

2

djangoprojectのドキュメントによるとLOCALE_PATHS、設定ファイルにリストされているすべてのパスが検索されます<language>/LC_MESSAGES/django.(po|mo)

次の行を setting.py に追加するだけです。

LOCALE_PATHS = (PATH + "/locale",)

プロジェクトのメインディレクトリはどこPATHですか。

于 2013-06-15T06:56:49.627 に答える