2013-03-10 6 views
5

के साथ डिफ़ॉल्ट त्रुटि संदेश बदले मैं साधारण से फ़ॉर्म से डिफ़ॉल्ट त्रुटि संदेश को बदलने के लिए प्रबंधित नहीं करते हैं, मैं साधारण से फ़ॉर्म लोकेल फ़ाइल को संपादित करने की कोशिश की लेकिन इसे अनदेखा किया जा करने के लिएsimple_form

यहाँ मेरी लोकेल फ़ाइल है लगता है:

किसी को भी जानता है करता है मैं गलत क्या कर रही हूं:

#config/locales/simple_form.en.yml 
en: 
    simple_form: 
    error_notification: 
     default_message: "A custom message:" 

लेकिन मैं अभी भी मिल "नीचे दी गई समस्याओं की समीक्षा करें?"

+0

क्या आपने उस फ़ाइल को बदलने के बाद ऐप को पुनरारंभ किया था? – Hesham

+0

हां, कोई सफलता नहीं .. – vdaubry

+0

अजीब। मेरे लिये कार्य करता है। मैं simple_form 2.1.0 का उपयोग कर रहा हूँ। – Hesham

उत्तर

1

बदलें अपनी :default_message को :your_model_name

आप in the source देख सकते हैं, error_notification विधि translate_error_notification का उपयोग करता YAML फ़ाइल से अनुवाद पाने के लिए।

def translate_error_notification 
    lookups = [] 
    lookups << :"#{object_name}" 
    lookups << :default_message 
    lookups << "Please review the problems below:" 
    I18n.t(lookups.shift, scope: :"simple_form.error_notification", default: lookups) 
end 

user मॉडल lookups के लिए शामिल हैं:

lookups == [:user, :default_messge, "Please review the problems below:] 

अनुवाद प्रत्येक वस्तु के लिए differrent तो इस लेन-देन कहा जाता है हो सकता है:

#config/locales/simple_form.en.yml 
en: 
    simple_form: 
    error_notification: 
     user: "A custom message:" 

वोट अगर यह मदद करेंगे;)

संबंधित मुद्दे