2014年8月9日土曜日

djangoのmakemessagesでのエラーメッセージにハマりかけたのでメモ

Djagnoの翻訳テキストファイルの作成コマンド

django-admin.pyもしくはmanager.pyのmakemessagesに翻訳に必要なファイルを自動生成させることが出来ます.
$./manager.py makemessages -l ja_JP

ところで,私がこれを行ったところ以下のようなメッセージが出力されました.


This script should be run from the Django Git tree or your project or app tree. If you did indeed run it from the Git checkout or your project or application, maybe you are just missing the conf/locale (in the django tree) or locale (for project and application) directory? It is not created automatically, you have to create it by hand if you want to enable i18n for your project or application.

えっとGitがどうとか言われていますが,結局のところプロジェクトに./localeディレクトリがないことが原因みたいでした.

というわけでプロジェクトディレクトリのルートで
$mkdir locale
$./manager.py makemessages -l ja_JP

として無事に翻訳用のテキストファイルが作成できました.
ふぅ〜.