Bug 1564406

Summary: Plural forms are used wrong in messages resulting in bugs when Polish language is used
Product: [Fedora] Fedora Reporter: Marcin Juszkiewicz <mjuszkie>
Component: dnfAssignee: rpm-software-management
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: dmach, mblaha, mhatina, packaging-team-maint, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-06 10:18:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcin Juszkiewicz 2018-04-06 08:00:26 UTC
Description of problem:

I decided to clean dnf cache after few updates. So I run simple command:

[root@puchatek hrw]# dnf clean all
Usunięto 4572 pliki

And noted that it used wrong grammar form. Polish is unlike English and we have a bit more complicated plural forms:

1 plik
2,3,4 pliki
5-20 plików

So in this case it should be "Usunięto 4572 plików".

Version-Release number of selected component (if applicable):

[root@puchatek hrw]# LANGUAGE=C LANG=C LC_ALL=C dnf --version
2.7.5
  Installed: dnf-0:2.7.5-8.fc28.noarch at Wed Mar 28 09:17:06 2018
  Built    : Fedora Project at Mon Feb 12 15:05:59 2018

  Installed: rpm-0:4.14.1-7.fc28.x86_64 at Wed Mar 28 09:17:05 2018
  Built    : Fedora Project at Mon Feb 19 09:29:01 2018


How reproducible:

probably always

Steps to Reproduce:
1. Gather some files in dnf cache.
2. LANGUAGE=pl_PL LANG=pl_PL LC_ALL=pl_PL dnf clean all

Actual results:

Usunięto 4572 pliki

Expected results:

Usunięto 4572 plików

Additional info:

Comment 1 Marek Blaha 2018-04-06 10:18:46 UTC
Hi Marcin,

we are using fedora.zanata.org for translating. Plural forms for polish language are defined (https://github.com/rpm-software-management/dnf/blob/master/po/pl.po) as

Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);

which, as far as I understand, means:
for 1 item use plural form 0
for any number ending with digits 2,3,4 and at the same time not ending with numbers 10,11,...19 use form 1
otherwise use form 2

your text is defined on line 104 with plural forms:

msgstr[0] "Usunięto %d plik"
msgstr[1] "Usunięto %d pliki"
msgstr[2] "Usunięto %d plików"

So I think, translation exactly followed given rules - 4572 ends with 2 and is not ending with 12, so form 1 was chosen.

If you think that definition of plurals for polish language is wrong, please reopen this bug against Fedora localization product.

Comment 2 Marcin Juszkiewicz 2018-04-06 10:33:29 UTC
Thanks for pointer. Will take a look.