1
번역 된 오류 메시지에 대한 지원을 구현하려는 양식 (simple_form 사용)이 있습니다. 모든 번역은 오류 메시지를 제외하고 나타납니다.사용자 정의 오류 메시지 번역
내 고객 모델은 다음과 같습니다
class Customer < ActiveRecord::Base
attr_accessible :name, :phone, :email, :contact_method
validates_presence_of :phone, :email, :contact_method, :message => I18n.t(:required)
end
내 fr.yml
파일을 다음과 같이
fr:
name: 'Nom'
phone: 'Téléphone'
email: 'Courriel'
contact_method: 'Méthode de contact'
required: 'Requis'
나의 양식은 다음과 같습니다
= simple_form_for @customer do |f|
= f.input :name, label: t(:name)
= f.input :phone, label: t(:phone)
= f.input :email, label: t(:email)
내가 부족 뭔가가 있나요?
우수한. 고맙습니다! – dspencer
도와 주셔서 감사합니다 :) –