2

我使用https://github.com/amatsuda/kaminari在我的rails項目分頁。kaminari page_entires_info錯誤與I18n.locale

此頁https://github.com/amatsuda/kaminari/issues/257顯示此幫助程序的問題。

我曾與從主分支添加到我的寶石文件雷檢查:

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

而且我已經與去年的版本kaminari 0.14.1檢查,但它仍然沒有翻譯成另一種語言:

我可以看到我的觀點的錯誤:

Display Entriestranslation missing: es.helpers.page_entries_info.more_pages.display_entries

我已經加入到我es.yml下一個代碼:第一

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: "..." 

的意見,最後一頁,上一頁...等工作正常,但page_entries_info:助手不工作的罰款。

如果有人設法解決這個問題,如果您分享解決方案將是很好的。感謝

回答

1

我有固定的問題:

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" 

關心!

2

我有同樣的問題...
我把這個在我的pt-BR.yml

pt-BR: 
    views: 
    pagination: 
     first: "&laquo; Primeiro" 
     last: "Ultimo &raquo;" 
     previous: "&lsaquo; Anterior" 
     next: "Proximo &rsaquo;" 
     truncate: "..." 

,這對我的application.rb

config.i18n.available_locales = ['pt-BR'] 
+0

謝謝,分頁工作正常,問題是'helpers.page_entries_info'等... – hyperrjas

0

添加到您的語言環境:

helpers: 
    page_entries_info: 
    one_page: 
     display_entries: "Mostrando todos os %{entry_name}" 
    more_pages: 
     display_entries: "Mostrando %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> de <b>%{total}</b> no total" 
0

我已經解決了我的問題,尋找我的YML文件內的另一個幫手聲明,這是怎麼回事。 你只需要削減這個kaminari的'助手'部分,並粘貼下面的部分,以便在你的文件中有一個'助手'聲明。

是這樣的:

 
helpers: 
    page_entries_info: 
     one_page: 
     display_entries: 
      zero: "Sem %{entry_name} encontrados" 
      one: "Mostrando 1 %{entry_name}" 
      other: "Mostrando todos %{count} %{entry_name}" 
     more_pages: 
     display_entries: "Mostrando %{entry_name} %{first} - %{last} de %{total} no total" 
    select: 
     prompt: Por favor selecione 
    submit: 
     create: Criar %{model} 
     submit: Salvar %{model} 
     update: Atualizar %{model} 

0

如果你願意,你可以使用這個:

en: 
    views: 
    pagination: 
     first: "&laquo; Primero" 
     last: "Último &raquo;" 
     previous: "&lsaquo; Anterior" 
     next: "Siguiente &rsaquo;" 
     truncate: "..." 
    helpers: 
    page_entries_info: 
     one_page: 
     display_entries: 
      zero: "No se encontraron datos, <strong>%{count}</strong> en total" 
      one: "Mostrando solo <strong>%{count}</strong> %{entry_name}" 
      other: "Mostrando un total de <strong>%{count}</strong> %{entry_name}" 
     more_pages: 
     display_entries: "Mostrando %{entry_name} del orden del <strong>%{first} al %{last}</strong> de un total de <strong>%{total}</strong>" 

不要忘記設置你的* .yml爲UTF-8(例如,在窗口)