#34 new
Javix

Interpolation in activerecord.errors.template.header.other & activerecord.errors.template.body not read

Reported by Javix | January 31st, 2011 @ 10:57 AM

I tried to translate the errors message header and body and it seems that the interpolation didn't work properly.
here is what I did in 'error_messages_helper.rb' file (I use nifty_generators gem):
[code] module ErrorMessagesHelper
# Render error messages for the given objects. The :message and :header_message options are allowed. def error_messages_for(*objects)

options = objects.extract_options!
options[:header_message] ||= t("activerecord.errors.template.header.other")
options[:message] ||= t("activerecord.errors.template.body")
messages = objects.compact.map { |o| o.errors.full_messages }.flatten
unless messages.empty?
  content_tag(:div, :class => "error_messages") do
    list_items = messages.map { |msg| content_tag(:li, msg) }
    content_tag(:h2, options[:header_message]) + content_tag(:p, options[:message]) + content_tag(:ul, list_items.join.html_safe)
  end
end

end

module FormBuilderAdditions

def error_messages(options = {})
  @template.error_messages_for(@object, options)
end

end end

ActionView::Helpers::FormBuilder.send(:include, ErrorMessagesHelper::FormBuilderAdditions)
[/code] When generating a validation error, I got:
[code] "Impossible d'enregistrer %{model} : %{count} erreurs" [/code] inteads of the translated model name and count value.
I also attache the translation 'yml' file.

Comments and changes to this ticket

  • Javix

    Javix January 31st, 2011 @ 11:01 AM

    • no changes were found...
  • Javix

    Javix March 10th, 2011 @ 05:53 PM

    • Tag set to solved

    OK, I think that we can close the issue as I found the way to solve the problem.
    That's how:

    • in my view(without using nifty-geberators gem), I had to precise the model to use and count to make them recongnized by interpolation:
    <%= form_for(@user) do |f| %>
      <% if @user.errors.any? %>
        <div id="error_explanation">      
          <h2><%= t('errors.template.header', :model=> @user.class.human_name, :count=> @user.errors.count) %></h2>
    
          <ul>
          <% @user.errors.full_messages.each do |msg| %>
            <li><%= msg %></li>
          <% end %>
          </ul>
        </div>
      <% end %>
    

    The translation file is unchanged as it is on github.
    Voilà, hope this helps.

  • Anderfelve1965

    Anderfelve1965 February 16th, 2019 @ 02:27 PM

    The specialized issues in gadgets are normal and it is difficult for the people to take that gadget to the master in light of the bustling timetable that is the reason to post your inquiry here and find the best solution by bestessays reviews it with the master people.

  • slotxo

    slotxo June 3rd, 2021 @ 12:35 PM

    เทคนิคสล็อต มากกว่าที่เราเห็น สล็อต xo หรือเคยได้ยินมายังไงล่ะ northbristol ซึ่งต้องเป็นคนที่เข้ามาเดิมพัน mavoixtavoie เท่านั้น herbalpertpresents ถึงจะทราบในข้อดีส่วนนี้ reeffutures2018 ความจริงแล้วสล็อต gclub ออนไลน์เป็นเกมที่ต้องอาศัยการคำนวณเข้าามาช่วยนิดหน่อย

  • slotxo

    slotxo June 9th, 2021 @ 12:18 PM

    northbristol วงล้อหมุนไป mavoixtavoie แล้วจะปรากฏรูปสัญลักษณ์ herbalpertpresents ต่าง ๆ ขึ้นมาในแต่ละรอบ reeffutures2018 คุณทราบไหมว่าสล็อตออนไลน์ xopg.net/ สามารถหมุนให้สัญลักษณ์แตกต่างกันได้เป็นร้อยรอบโดยไม่ต้องมีรอบซ้ำเลย essentialsforasoul แต่หากสังเกตดี ๆ จะเห็นได้ว่าในการหมุนแต่ละครั้งมักจะออกซ้ำกันบ่อย gclub เพราะแบบนี้เองที่ทำให้ท่านกำลังได้รู้ถึงจุดอ่อนของเจ้าสล็อตออนไลน์เข้าแล้ว

  • slotxo

    slotxo June 17th, 2021 @ 12:18 PM

    AMBBET เมื่อเราเล่นเกมสล็อตชนะ ambbet โปร หรือได้โบนัสตามเงื่อนไข AMB ของคาสิโนออนไลน์ สมัคร amb บอกเลยว่า บาคาร่า เงินทุกบาทที่ได้จากการ เกมสล็อต เล่น เว็บคาสิโน สามารถเอาออกมาใช้ได้จริง เกมคาสิโน สำหรับการเล่นนี้

  • slotxo

    slotxo June 18th, 2021 @ 12:24 PM

    pg สล็อตเป็นเกม โปร pg ที่ใครก็สามารถ สมัคร pg เข้ามาหาความสนุก PG SLOT และเพลิดเพลินกับบริการสุดประทับใจได้ ทดลองเล่น pg 24 ชั่วโมง เทคนิคสล็อต ยิ่งในปัจจุบัน สล็อต PG ที่การเข้าถึงอินเตอร์เน็ต

  • slotxo

    slotxo June 23rd, 2021 @ 01:29 PM

    northbristol วงล้อหมุนไป mavoixtavoie แล้วจะปรากฏรูปสัญลักษณ์ herbalpertpresents ต่าง ๆ ขึ้นมาในแต่ละรอบ reeffutures2018 คุณทราบไหมว่าสล็อตออนไลน์ xopg.net/ สามารถหมุนให้สัญลักษณ์แตกต่างกันได้เป็นร้อยรอบโดยไม่ต้องมีรอบซ้ำเลย essentialsforasoul แต่หากสังเกตดี ๆ จะเห็นได้ว่าในการหมุนแต่ละครั้งมักจะออกซ้ำกันบ่อย gclub เพราะแบบนี้เองที่ทำให้ท่านกำลังได้รู้ถึงจุดอ่อนของเจ้าสล็อตออนไลน์เข้าแล้ว

  • slotxo

    slotxo June 24th, 2021 @ 02:08 PM

    joker gaming รวมกับการวางแผนการเงินในการ joker โปร ลงเดิมพันของนัก สมัคร joker เดิมพันด้วย หากจะลอง เทคนิคสล็อต สังเกตในสล็อตออนไลน์ slot joker จะเห็นได้ว่าเมื่อ

  • slotxo

    slotxo June 29th, 2021 @ 11:13 AM

    AMBBET เมื่อเราเล่นเกมสล็อตชนะ ambbet โปร หรือได้โบนัสตามเงื่อนไข AMB ของคาสิโนออนไลน์ สมัคร amb บอกเลยว่า บาคาร่า เงินทุกบาทที่ได้จากการ เกมสล็อต เล่น เว็บคาสิโน สามารถเอาออกมาใช้ได้จริง เกมคาสิโน สำหรับการเล่นนี้

  • slotxo

    slotxo June 30th, 2021 @ 11:47 AM

    superslot ซึ่งเมื่อเริ่มจับจังหวะของเจ้าสล็อตได้ โปร 100 ท่านจะเริ่มสนุกกักมมากขึ้น สมัคร super และ ทดลองเล่นสล็อต จะเข้าใกล้ เทคนิคสล็อต ความสำเร็จในการเดิมพัน slotsuper มากขึ้นเรื่อย ๆ gclub แบบที่ยิ่งเล่นยิ่งมันแล้วหลังจากนั้นท่านจะ xopg.net/ ต้องเลือกหรือตัดสินใจอีกครั้งว่า

  • Rise

    Rise August 11th, 2021 @ 11:24 AM

    Kegiatan Heboh di Puri Mataram Sleman – Puri Mataram adalah salah satu lokasi rekreasi yang termasuk cukup baru dan populer di Sleman.

    Berada di Desa Drono, Tridadi, Kecamatan Sleman, https://indahnyanegeri.com/ tempat rekreasi ini diatur oleh BUMDes (Badan Usaha Punyai Dusun) setempat.

  • Sally

    Sally August 12th, 2021 @ 08:38 PM

    Bandar Judi Casino Langsung Online – Penentuan bandar judi boleh terlampau melelahkan untuk mereka yang memang tidak menyadari dari mana seharusnya validasi pencarian dilakukan. Saat bagi yg memang pernah amat menyadari bersama paham https://questo-casino.com, para tentu hendak boleh amat sederhana sekali mencari semuanya.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff

People watching this ticket

Attachments

Tags

Pages