Finnish pluralization error in logs


#1

From my logs:

I18n::InvalidPluralizationData (translation data {:one=>"Tuoreimmat (1)"} can not be used with :count => 0)
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/lib/i18n/backend/pluralization.rb:35:in `pluralize'

Is this a problem?

Finnish locale. @rizka or @ljpp, have you had this error?


(Jeff Atwood) #2

It is a mistake in the localization.


#3

How could it be fixed? Is the problem in the (1) or something else?


(Jeff Atwood) #4

Probably can be fixed on transifex like most translation issues.


(rizka) #5

At first glance it looks like an issue with js.filters.latest.title_with_count. On the other hand, I don’t think there is anything wrong with that string. I stared at it and compared it to the Swedish and German locales and didn’t discover anything.

It could have something to do with pluralization rules associated with the Finnish locale. I never touched the rules however so I don’t know where to look for them. I could dig into it tomorrow.


(rizka) #6

Reading the error message, it must have something to do with this. What triggers it is a more difficult question because I don’t understand much about the code structure.

I did some digging yesterday and the pluralization rules don’t explain it as far as I can see. The rules are exact copies of rules of German, English etc which is natural since the rule is the same. Singular is used when there is one item, else you use the plural form. Looking at the message, does it tell that it is trying to use the singular string “Tuoreimmat (1)” (Tuoreimmat stands for Latest) when there are 0 latest topics? If yes, I don’t understand why it would do so in Finnish locale only.

Helpful links:




(Claas Aug.) #7

The rules seem to be defined here, but it’s the same rule as the one for English:

However, I cannot reproduce the problem locally:

$ vagrant ssh
$ cd /vagrant
$ rails c
$ I18n.t('js.filters.latest.title_with_count', :locale => 'fi', :resolve => false)
=> {:one=>"Tuoreimmat (1)", :other=>"Tuoreimmat ({{count}})"}
$ I18n.t('i18n.plural.rule', :locale => 'fi', :resolve => false).call(0)
=> :other

(Claas Aug.) #8

The translations for the one case (js.filters.latest.title_with_count.one) has only been added in August, so that’s the proper reason. Updating to v1.7.0.beta3 (or higher) solves the problem.


(rizka) #9

Are you sure that’s the cause? The change was just a typo fix (Tuoremmat --> Tuoreimmat). If it was about that, it should show the old version instead of triggering an error, right? Except in @Silvanus’ case, because he has a local fix applied. I didn’t remember that discussion until now.

It raises a question: could it perhaps have something to do with the local modification?


(Claas Aug.) #10

Thanks for pointing that out. You’re right and I misread the diff. :slight_smile:

@Silvanus What do you get if you type this in your Discourse instance folder:

$ ./launcher enter app
$ rails c
# Wait for Rails console to start
$ I18n.t('js.filters.latest.title_with_count', :locale => 'fi', :resolve => false)

#11

Result:

=> {:one=>"Tuoreimmat (1)", :other=>"Tuoreimmat ({{count}})"}

I’m not running local change anymore. Did a full reinstall and restored site from backup.