Issue with pluralized (count) translation override

Hello :wave:

I’ve noticed the latest update uses the one version of the pluralized strings if the count is 1. The problem is, until now the pluralized strings always used the other version even if the count is 1 and on /admin/customize/site_texts/ there is no option to find the one version of the string for example on Hungarian language. However on Hungarian there is no reason to use both version (one and other) because it’ll be pretty much the same.

Repro:

  1. Change locale e.g. Hungarian
  2. Go to /admin/customize/site_texts/
  3. Search e.g. js.topic_count_latest and change the text.
  4. Check it on the See new or updated topics banner.
  5. It will use the default value when there is only 1 update available because the string you edited is the other version. If there is more new or updated topics the text will be change to what you added before.

Thank you :slightly_smiling_face:

3 Likes

Hello @Don

I did this test on Simplified Chinese and could not reproduce this issue :thinking:

I added an extra char (highlighted) to the original string. And the change did happen when count was 1.

image

image

1 Like

Both languages have only “other” in their plurals definition

But Hungarian still has sparate translations for “one”.

which Chinese does not have

I wonder why the separate “one” version is created in Crowdin

2 Likes

Yeah, there are two versions in the Hungarian locale (one and other), but I think it never used the one version until now as it isn’t available in admin text customization either. It always fell back to the other.

1 Like

Can I ask, does Hungarian have any plural forms? If so, maybe we should add :one defination to plurals.rb

1 Like

I found the cause of the issue. Discourse’s I18n relies on the plural definition of an external library:

But in this library, we can see that Hungarian is defined as using type a-class plurals, which distinguish between one and other.

I don’t understand Hungarian at all, maybe someone could help point out whether their plural definition is wrong or ours :slightly_smiling_face:

3 Likes

Hello :wave:

Thanks for checking it. :heart:

Well, in Hungarian we have plural but not always which makes it little difficult. But let me explane some simple examples.

Most of Hungarian words have plural version.
If it’s uncountable.
E.g.
Group → Groups = Csoport → Csoportok
Topic → Topics = Téma → Témák

So it think that external library is correct in that we have plural form.

But we don’t use plural if there is a number (count) before words.
If it’s countable.
E.g.
1 group → 2 groups = 1 csoport → 2 csoport
1 topic → 2 topics = 1 téma → 2 téma


If you check the Hungarian language file you can see the plurals are always the same.

Hovewer I see there are strings which is not use count on form one.

Like this:

It’s ok because we don’t need the count in this case when only 1 topic it’s pretty obvious. But the other one difference here is only that the other is appears a number. The text is same no matter there is number or not.


So if you ask me I just would remove the one form.

But if it’s coming from an external library which is I think correct, because Hungarian have plural form but not most of cases that Discourse uses. So probably adding the one form to have the abality to customize it would be the easiest solution to prevent the issues. Yeah it is mooostly same but at least we can customize it in admin.

I don’t know it’s a hard question. As everyone who running a Hungarian forum and made customization in admin have been changed only the other form. Because it fell back to other from one always. So if we add the one form, admins have to review again all of the plural strings to modify that version too to be the same as other.

Thanks :slightly_smiling_face:

2 Likes

Thank you for your detailed response! Bug fix have been merged:

The fix adds :one form for Hungarian. Future crowdin translators may can try to remove %{count} for singular to make it look different from the :other form.

5 Likes

Thanks for the quick fix. :heart:

I think it’s ok, the %{count} is nicely follow the English locale. Which also don’t use %{count} in some plural strings one form. Now the change is only we can edit the one form in admin too which is enough I think in this case. I think if it’s work correctly no need to other changes. I’ll update soon to test it. :slightly_smiling_face:

Seems everything works excellent :slightly_smiling_face: That was a great pastime to change all these but I almost done with it. :smile: Thanks again and thank you @Moin too to point this out. :heart:

4 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

Tracking the wider issue at Inconsistency in plural definition

2 Likes