10

モンゴイドとモデルの翻訳に問題があります。モデルで mongoDB を使用しようとしているときに、属性とモデル名を変換する方法がわかりません。通常は *.yml ファイルにありますが、今回は機能しません。何か案は?

4

4 に答える 4

15

「activemodel」を使用したバリアントは機能しません。しかし。

この変種は私のために働いた:

 en:
  mongoid:
    errors:
      models:
        user:
          attributes:
            email:
              blank: "You have to give me your e-mail address"
              not_found: "e-mail address not found in list of members"
              #...
    attributes:
      user:
        email: "Email address"
        name: "Your nickname"
        #...

ここから

于 2011-09-14T09:51:24.180 に答える
7

yml ファイル (私の場合は config/locales/pt-BR.yml) でこれを試してください:

 activemodel:
    attributes:
      [model_name]:
        [attribute1]: "[translation1]"
        [attribute2]: "[translation2]"
        [attribute3]: "[translation3]"

mongoid 2.0.0.beta.17 と rails 3.0.0 を使用して、私のために働いた

于 2010-10-24T17:24:02.847 に答える