Rails3 validation error message is changed by i18n (Japanese)

  • メモ
    • active support の inflection である pluralize は Railsi18n の守備範囲外だから、model_name.human の後はダメ
  • Terminal 起動
  • vim rails3/attend/config/application.rb

# config.i18n.default_locale = :de
config.i18n.default_locale = :ja

# Japanese translations for Ruby on Rails
# by Akira Matsuda (ronnie@dio.jp)
# AR error messages are basically taken from Ruby-GetText-Package. Thanks to Masao Mutoh.
# contributors:
# - Tsutomu Kuroda (t-kuroda@oiax.jp)


ja:
 date:
  formats:
   default: "%Y/%m/%d"
   short: "%m/%d"
   long: "%Y年%m月%d日(%a)"


  day_names: [日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日]
  abbr_day_names: [日, 月, 火, 水, 木, 金, 土]


  month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
  abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]


  order:
   - :year
   - :month
   - :day


 time:
  formats:
   default: "%Y/%m/%d %H:%M:%S"
   short: "%y/%m/%d %H:%M"
   long: "%Y年%m月%d日(%a) %H時%M分%S秒 %Z"
  am: "午前"
  pm: "午後"


 support:
  array:
   sentence_connector: "と"
   skip_last_comma: true
   words_connector: "と"
   two_words_connector: "と"
   last_word_connector: "と"


  select:
   prompt: "選択してください。"


 number:
  format:
   separator: "."
   delimiter: ","
   precision: 3
   significant: false
   strip_insignificant_zeros: false


  currency:
   format:
    format: "%n%u"
    unit: "円"
    separator: "."
    delimiter: ","
    precision: 3
    significant: false
    strip_insignificant_zeros: false


  percentage:
   format:
    delimiter: ""


  precision:
   format:
    delimiter: ""


  human:
   format:
    delimiter: ""
    precision: 3
    significant: true
    strip_insignificant_zeros: true


   storage_units:
    format: "%n%u"
    units:
     byte: "バイト"
     kb: "キロバイト"
     mb: "メガバイト"
     gb: "ギガバイト"
     tb: "テラバイト"


   decimal_units:
    format: "%n %u"
    units:
     unit: ""
     thousand: "千"
     million: "百万"
     billion: "十億"
     trillion: "兆"
     quadrillion: "千兆"


 datetime:
  distance_in_words:
   half_a_minute: "30秒前後"
   less_than_x_seconds:
    one:  "1秒以内"
    other: "%{count}秒以内"
   x_seconds:
    one:  "1秒"
    other: "%{count}秒"
   less_than_x_minutes:
    one:  "1分以内"
    other: "%{count}分以内"
   x_minutes:
    one:  "1分"
    other: "%{count}分"
   about_x_hours:
    one:  "約1時間"
    other: "約%{count}時間"
   x_days:
    one:  "1日"
    other: "%{count}日"
   about_x_months:
    one:  "約1ヶ月"
    other: "約%{count}ヶ月"
   x_months:
    one:  "1ヶ月"
    other: "%{count}ヶ月"
   about_x_years:
    one:  "約1年"
    other: "約%{count}年"
   over_x_years:
    one:  "1年以上"
    other: "%{count}年以上"
   almost_x_years:
    one:  "1年弱"
    other: "%{count}年弱"


  prompts:
   year:  "年"
   month: "月"
   day:  "日"
   hour:  "時"
   minute: "分"
   second: "秒"


 helpers:
  select:
   prompt: "選択してください。"


  submit:
   create: "登録する"
   update: "更新する"
   submit: "保存する"


 errors:
  format: "%{attribute}%{message}"


  messages: &errors_messages
   inclusion: "は一覧にありません。"
   exclusion: "は予約されています。"
   invalid: "は不正な値です。"
   confirmation: "が一致しません。"
   accepted: "を受諾してください。"
   empty: "を入力してください。"
   blank: "を入力してください。"
   too_long: "は%{count}文字以内で入力してください。"
   too_short: "は%{count}文字以上で入力してください。"
   wrong_length: "は%{count}文字で入力してください。"
   not_a_number: "は数値で入力してください。"
   not_an_integer: "は整数で入力してください。"
   greater_than: "は%{count}より大きい値にしてください。"
   greater_than_or_equal_to: "は%{count}以上の値にしてください。"
   equal_to: "は%{count}にしてください。"
   less_than: "は%{count}より小さい値にしてください。"
   less_than_or_equal_to: "は%{count}以下の値にしてください。"
   odd: "は奇数にしてください。"
   even: "は偶数にしてください。"


 activerecord:
  errors:
   template:
    header:
     one:  "%{model}にエラーが発生しました。"
     other: "%{model}に%{count}つのエラーが発生しました。"
    body: "次の項目を確認してください。"


   messages:
    taken: "はすでに存在します。"
    record_invalid: "バリデーションに失敗しました。 %{errors}"
    <<: *errors_messages

   full_messages:
    format: "%{attribute}%{message}"