Rails 6 pluralize(count, word) VS word.pluralize(count) - different results

Viewed 79

I am using Portuguese in my Rails 6 app and want to use the pluralizer.

So I added the Portuguese rules to my inflections. (https://gist.github.com/mateusg/924574)

The word casal (couple) in plural is casais.

When I do

pluralize('casal',2) I get 2 casais (correct)

But when I try

'casal'.pluralize(2) I get casals (wrong)

I am not worried about the number but about the fact that one way pluralizes correctly and the other not.

Any ideas?

1 Answers

The default locale for pluralize as a helper is I18n.locale.

For the String method it is :en. You'll have to pass in I18n.locale or avoid the method.

Related