unfoldedcircle / feature-and-bug-tracker

Feature and bug tracker repository for Unfolded Circle products
25 stars 0 forks source link

[feature request] Proper support for plural forms in translations #196

Open yawor opened 10 months ago

yawor commented 10 months ago

Is there an existing issue for this?

Description

I've added and updated some translations today on crowdin for Polish and I've noticed two source strings: %1 entity and %1 entites, where %1 seems to be a number of entities. This means that the software doesn't use a proper support in Qt for plural forms in translations and instead uses hardcoded condition whether there's either one or more entities and displays one of the two strings. Qt has support for proper plural form selection based on rules for every language. Here's the documentation: https://doc.qt.io/qt-6/i18n-source-translation.html#handle-plural-forms Not every language has only two forms (for single and multiple items). For example Polish has three forms (for example, the translation for the 1 entity/N entities would be: 0 encji, 1 encja, 2 encje, ..., 5 encji, 22 encje, ..., 25 encji etc). This is also true for Czech, Irish, Latvian, Lithuanian, Macedonian, Romanian, Russian and Slovak, but each language has different rules for selecting correct form. French has just two forms, but the rule is different than in English (English uses second form for 0 items, but in French 0 and 1 item uses the same form).

Crowdin supports translation files with plural forms so it should not be a problem. Based on the rule for the active language, it will show correct number of forms to translate.

Additional context

No response