1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00
resolve kaminari/kaminari#850
This commit is contained in:
Kacper Tarchała 2017-01-20 12:02:57 +01:00
parent ab49ccd2d5
commit 4c56712ed2
3 changed files with 24 additions and 2 deletions

View file

@ -327,7 +327,16 @@ en:
If you use non-English localization see [i18n rules](https://github.com/svenfuchs/i18n/blob/master/test/test_data/locales/plurals.rb) for changing
`one_page:display_entries` block.
If you were translating models names you can turn on case sensivite by:
```
de:
activerecord:
models:
document:
one: "Buch"
other: "Bücher"
kaminari_case_sensitive: true
```
## Customizing the Pagination Helper
Kaminari includes a handy template generator.

View file

@ -101,7 +101,9 @@ module Kaminari
entry_name = if entry_name
entry_name.pluralize(collection.size)
else
collection.entry_name(count: collection.size).downcase
case_sensitive = I18n.t("activerecord.models.#{collection.first.class.name.downcase}.kaminari_case_sensitive")
entry_name = collection.entry_name(count: collection.size)
case_sensitive == true ? entry_name : entry_name.downcase
end
if collection.total_pages < 2

View file

@ -266,6 +266,17 @@ if defined?(::Rails::Railtie) && defined?(::ActionView)
I18n.backend.reload!
end
end
test 'page_entries_info translates entry with case sensitive' do
users = User.page(1).per(25)
begin
I18n.backend.store_translations(:en, User.i18n_scope => { models: { user: { one: "person", other: "PeoPle", kaminari_case_sensitive: true } } })
assert_equal 'Displaying PeoPle <b>1&nbsp;-&nbsp;25</b> of <b>50</b> in total', view.page_entries_info(users)
ensure
I18n.backend.reload!
end
end
end
sub_test_case 'on a model with namespace' do