Skip to content
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 method redefinition warnings when pluralizations are reloaded #1128

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

casperisfine
Copy link

Fix: #735

Whenever pluralization rules are reloaded it causes a lot of warnings:

lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: previous definition of rule was here
...

This is mostly harmless, but annoying for users who try to run with no warnings at all.

cc @pama

NB: I chose not to split this code in lots of small files because I don't think it's particularly useful. But if you think it is I can do it.

@sunny
Copy link
Contributor

sunny commented Sep 23, 2024

Thank you! Could you include an entry to the CHANGELOG? 🙏🏻

Fix: svenfuchs#735

Whenever pluralization rules are reloaded it causes a lot of warnings:

```
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/ar.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/gd.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/hsb.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lt.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/lv.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/mk.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/pl.rb:4: warning: previous definition of rule was here
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: method redefined; discarding old rule
lib/rails_i18n/../../rails/pluralization/sl.rb:4: warning: previous definition of rule was here
...
```

This is mostly harmless, but annoying for users who try to run with no warnings at all.
@pama pama merged commit 9583e1f into svenfuchs:master Sep 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

warning: method redefined
4 participants