Note that there are some explanatory texts on larger screens.

plurals
  1. POrails-i18n not working for header error
    text
    copied!<p>I'm using the <a href="https://github.com/svenfuchs/rails-i18n" rel="nofollow">rails-i18n gem</a> to use <code>:hr</code> for my main language.</p> <p>The gem works but for <code>header message</code> it doesn't.</p> <p>(The <code>4 errors prohibited this list from being saved:</code> part)</p> <p>This is what I get when I submit the form with invalid atributes:</p> <pre><code>4 errors prohibited this list from being saved: #doesn't translate Field1 ne smije biti prazan #translates/presence Field2 ne smije biti prazan #translates/presence Field3 ne smije biti prazan #translates/presence Filed4 nije odgovarajuće duljine (treba biti 11 znakova) #translates/length </code></pre> <p>As for the code, I only added <code>config.i18n.default_locale = :hr</code> to <code>config/application.rb</code>.</p> <p>In the documentation in says:</p> <blockquote> <p>Following locales are complete:</p> <p>bs, da, en, en-US, es-PA, <strong>hr</strong>, is, ja, nl, sr, ur, zh-HK</p> </blockquote> <p>Tested with other locales but is still doesn't translate the <code>4 errors prohibited this list from being saved:</code> part.</p> <p>Am I doing something wrong or there are translations missing in the <code>.yml</code> files ?</p> <p>Note: I use rails 4.0.0</p> <p><strong>Update:</strong></p> <pre><code>&lt;%= form_for(@report) do |f| %&gt; &lt;% if @report.errors.any? %&gt; &lt;div id="error_explanation"&gt; &lt;h2&gt;&lt;%= pluralize(@report.errors.count, "error") %&gt; prohibited this list from being saved:&lt;/h2&gt; &lt;ul&gt; &lt;% @report.errors.full_messages.each do |msg| %&gt; &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; &lt;/div&gt; &lt;% end %&gt; &lt;div class="form-container"&gt; &lt;div class="inline half"&gt; &lt;div class="field"&gt; &lt;%= f.label :field1 %&gt;&lt;br&gt; &lt;%= f.text_field :field1 %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :field2 %&gt;&lt;br&gt; &lt;%= f.text_field :field2 %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :field3 %&gt;&lt;br&gt; &lt;%= f.text_field :field3 %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :field4 %&gt;&lt;br&gt; &lt;%= f.text_field :field4 %&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="inline half"&gt; &lt;div class="actions"&gt; &lt;%= f.submit "Create", class: "continue-button" %&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload