Skip to content
This repository was archived by the owner on Jun 29, 2020. It is now read-only.

国際化の方法

giginet edited this page Oct 19, 2014 · 3 revisions

詳しくは

下記を読むこと

http://docs.djangoproject.jp/en/latest/topics/i18n/translation.html

忙しい人のための全体の流れ

  1. transタグに書く
  2. makemessagesをするとpoっていう辞書データができる
  3. poを普通にエディタで編集する
  4. compilemessagesする
  5. moというバイナリが生成される。実際に読み込まれて使われるのはこれ

gettextの導入

MacならHomebrewで入る

$ brew install gettext
$ brew link --force gettext

これでOK

poを作成する

$ cd kawaz3rd
$ python manage.py makemessages

辞書を編集する

src/kawaz/locale/ja/LC_MESSAGES/django.poを編集。後はわかるな・・・・・・

辞書をコンパイルする

$ cd kawaz3rd
$ python manage.py compilemessages

これで、django.moというファイルが更新される

確認する

普通にブラウザでアクセスして確認してください

注意

ブラウザやOSの言語設定が英語優先になってると、ちゃんとローカライズされていても英語で表示されてしまいます。注意。

Clone this wiki locally