Search code examples
ruby-on-railsrubyruby-on-rails-3ruby-on-rails-3.1kaminari

kaminari page_entires_info error with I18n.locale


I use https://github.com/amatsuda/kaminari for pagination on my rails projects.

On this page https://github.com/amatsuda/kaminari/issues/257 show the issue with this helper.

I have checked with adding to my gem file kaminari from master branch:

gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'

Also I have checked with last version kaminari 0.14.1, but it still does not translate to another language:

I can see on my view the error:

Display Entries with translation missing: es.helpers.page_entries_info.more_pages.display_entries

I have added to my es.yml the next code:

helpers:
    page_entries_info:
      one_page:
        display_entries:
          zero: "Ningún %{entry_name} encontrado"
          one: "Mostrando <b>1</b> %{entry_name}"
          other: "Mostrando <b>todos %{count}</b> %{entry_name}"
      more_pages:
        display_entries: "Mostrando %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> de <b>%{total}</b> en total"
  views:
    pagination:
      first: "&laquo; Primero"
      last: "Último &raquo;"
      previous: "&lsaquo; Anterior"
      next: "Siguiente &rsaquo;"
      truncate: "..."

The views first, last, previous...etc is working fine but the page_entries_info: helper is not working fine.

if anyone has managed to solve this problem, would be nice if you share the solution. thanks


Solution

  • I have fixed the problem with:

    helpers:
      page_entries_info:
        one_page:
          display_entries:
            zero: "Ningún %{entry_name} encontrado"
            one: "Mostrando <b>1</b> %{entry_name}"
            other: "Mostrando <b>todos %{count}</b> %{entry_name}"
          more_pages:
            display_entries: "Mostrando %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> de <b>%{total}</b> en total"
    

    Regards!