mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
parent
ab49ccd2d5
commit
4c56712ed2
3 changed files with 24 additions and 2 deletions
11
README.md
11
README.md
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 - 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
|
||||
|
|
Loading…
Reference in a new issue