Skip to content

Commit

Permalink
Merge pull request #855 from kaminari/revert-854-entry_name_with_case…
Browse files Browse the repository at this point in the history
…_sensitive

Revert "add option: entry name with case sensitive in I18n"
  • Loading branch information
yuki24 committed Jan 21, 2017
2 parents 16a6619 + 5df6c42 commit a407506
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
11 changes: 1 addition & 10 deletions README.md
Expand Up @@ -327,16 +327,7 @@ 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.
Expand Down
4 changes: 1 addition & 3 deletions kaminari-core/lib/kaminari/helpers/helper_methods.rb
Expand Up @@ -101,9 +101,7 @@ def page_entries_info(collection, entry_name: nil)
entry_name = if entry_name
entry_name.pluralize(collection.size)
else
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
collection.entry_name(count: collection.size).downcase
end

if collection.total_pages < 2
Expand Down
11 changes: 0 additions & 11 deletions kaminari-core/test/helpers/action_view_extension_test.rb
Expand Up @@ -266,17 +266,6 @@ def to_s
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
Expand Down

0 comments on commit a407506

Please sign in to comment.