Adding i18n to page_entries_info fixes #208
This commit is contained in:
parent
6df7869cbd
commit
8fedb4f77d
|
@ -8,3 +8,12 @@ en:
|
||||||
previous: "‹ Prev"
|
previous: "‹ Prev"
|
||||||
next: "Next ›"
|
next: "Next ›"
|
||||||
truncate: "..."
|
truncate: "..."
|
||||||
|
helpers:
|
||||||
|
page_entries_info:
|
||||||
|
one_page:
|
||||||
|
display_entries:
|
||||||
|
zero: "No %{entry_name} found"
|
||||||
|
one: "Displaying <b>1</b> %{entry_name}"
|
||||||
|
other: "Displaying <b>all %{count}</b> %{entry_name}"
|
||||||
|
more_pages:
|
||||||
|
display_entries: "Displaying %{entry_name} <b>%{first} - %{last}</b> of <b>%{total}</b> in total"
|
||||||
|
|
|
@ -94,20 +94,16 @@ module Kaminari
|
||||||
entry_name = entry_name.underscore.sub('_', ' ')
|
entry_name = entry_name.underscore.sub('_', ' ')
|
||||||
end
|
end
|
||||||
entry_name = options[:entry_name] unless options[:entry_name].nil?
|
entry_name = options[:entry_name] unless options[:entry_name].nil?
|
||||||
|
entry_name = entry_name.pluralize unless collection.total_count == 1
|
||||||
output = ""
|
output = ""
|
||||||
if collection.num_pages < 2
|
if collection.num_pages < 2
|
||||||
output = case collection.total_count
|
output = t("helpers.page_entries_info.one_page.display_entries", { :count => collection.total_count, :entry_name => entry_name })
|
||||||
when 0; "No #{entry_name.pluralize} found"
|
|
||||||
when 1; "Displaying <b>1</b> #{entry_name}"
|
|
||||||
else; "Displaying <b>all #{collection.total_count}</b> #{entry_name.pluralize}"
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
offset = (collection.current_page - 1) * collection.limit_value
|
offset = (collection.current_page - 1) * collection.limit_value
|
||||||
output = %{Displaying #{entry_name.pluralize} <b>%d - %d</b> of <b>%d</b> in total} % [
|
output = t("helpers.page_entries_info.more_pages.display_entries", { :entry_name => entry_name,
|
||||||
offset + 1,
|
:first => offset + 1,
|
||||||
offset + collection.current_page_count,
|
:last => offset + collection.current_page_count,
|
||||||
collection.total_count
|
:total => collection.total_count })
|
||||||
]
|
|
||||||
end
|
end
|
||||||
output.html_safe
|
output.html_safe
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue