Skip to content

Conversation

@KaanOzkan
Copy link
Contributor

Summary

parameterize is triggering I18n#transliterate. This method already
accepts a locale. It would be cleaner if, similar to other string inflection
methods, parameterize also accepted 'locale' as a parameter.

https://github.com/ruby-i18n/i18n/blob/master/lib/i18n.rb#L268

Parameterize is triggering I18n#transliterate. This method already
accepts a locale. It would be cleaner if similar to other string inflection
methods #parameterize also accepted 'locale' as a parameter.
def parameterize(string, separator: "-", preserve_case: false, locale: nil)
# Replace accented chars with their ASCII equivalents.
parameterized_string = transliterate(string)
parameterized_string = transliterate(string, locale)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be locale: locale?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️ Good find!

@KaanOzkan
Copy link
Contributor Author

@sharang-d Are you adding it to your PR with tests or should I change it?

@sharang-d
Copy link
Contributor

@KaanOzkan I'm including it in my changes if that's alright :)

@KaanOzkan
Copy link
Contributor Author

@sharang-d Thank you! Please go ahead, I didn't want to change anything without tests again and you already started testing them. Thanks again.

suketa added a commit to suketa/rails_sandbox that referenced this pull request Sep 8, 2019
Add locale option to #parameterize
rails/rails#35571
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants