-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix index for Polish books #422
Conversation
Codecov Report
@@ Coverage Diff @@
## main #422 +/- ##
=======================================
Coverage 99.96% 99.96%
=======================================
Files 179 179
Lines 2710 2712 +2
=======================================
+ Hits 2709 2711 +2
Misses 1 1
|
@KarinaMendez2 Can you give me examples of Spanish words that start with special characters so I can test them? As I remember you use transliterate method for Spanish books. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like what you've done here! One naming-related comment, but otherwise it looks great to me 🎉
lib/kitchen/patches/i18n.rb
Outdated
@@ -4,6 +4,10 @@ | |||
|
|||
# rubocop:disable Style/Documentation | |||
module I18n | |||
def self.group_by(character) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
group_by
as a name makes sense in the context of indexes, but this function doesn't group anything, it just decides what character to return based on locale. Maybe a better name would be something like transliterate_for_index
or character_to_group
, or something I haven't thought of! lmk what you think :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good point 👍 I didn't think about it. I like very much second proposition. It's more descriptive. I made a fix for that.
def stub_locales(hash, locale: nil) | ||
@locales_are_stubbed = true | ||
|
||
language = locale || :test | ||
|
||
I18n.config.available_locales = %i[test en es pl] | ||
allow_any_instance_of(I18n::Config).to receive(:backend).and_return( | ||
I18n::Backend::Simple.new.tap do |backend| | ||
backend.store_translations 'test', hash | ||
backend.store_translations language, hash | ||
end | ||
) | ||
|
||
assign_i18n_dot_locale(:test) | ||
assign_i18n_dot_locale(language) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
Issue: #442