Plural forms in the style KCM

Ingo Klöcker kloecker at kde.org
Wed Sep 2 11:37:09 BST 2026


On Mittwoch, 2. September 2026 10:29:36 Mitteleuropäische Sommerzeit Ingo 
Klöcker wrote:
> On Mittwoch, 2. September 2026 10:22:50 Mitteleuropäische Sommerzeit Freek
> de
> Kruijf wrote:
> > Op woensdag 2 september 2026 10:18:46 Midden-Europese zomertijd schreef
> > 
> > Kisaragi Hiu:
> > > Good day,
> > > 
> > > 
> > > AFAIK this should still work for any language.
> > > 
> > > https://invent.kde.org/plasma/plasma-workspace/-/blob/master/kcms/style/
> > > 
> > > kcmstyle.cpp?ref_type=heads#L225:
> > >             message = i18ncp("@info:status",
> > >             
> > >                              "Successfully uninstalled “%2” but could
> > >                              not
> > > 
> > > uninstall others:\n",
> > > 
> > >                              "Successfully uninstalled %1 styles but
> > >                              could
> > > 
> > > not uninstall others:\n",
> > > 
> > >                              uninstalled.size(),
> > >                              uninstalled.first());
> > > 
> > > i18ncp uses the first integer-valued argument as the number that is
> > > plugged
> > > into the plural forms expression. That expression is decided by the
> > > particular PO file and does not assume Germatic plurals.
> > > https://invent.kde.org/frameworks/ki18n/-/blob/master/docs/programmers-g
> > > ui
> > > d
> > > e.md#gen_usage:~:text=The%20plural%20form%20is%20decided%20by%20the%20fi
> > > rs
> > > t% 20integer%2Dvalued%20argument
> > > 
> > > 
> > > (note: a guide should not be the only place some information is
> > > documented,
> > > but right now the ki18n documentation does not mention this fact in the
> > > reference docs, only in this guide. I might try to open an MR for
> > > this...)
> > > 
> > > 
> > > So, the size is passed into the plural-forms expression of the target
> > > language to decide which msgstr to use, in addition to being the value
> > > to
> > > fill into the %1 placeholder.
> > > 
> > > 
> > > So it should still work fine with non-Germatic languages no matter how
> > > complicated the plural-forms expression is.
> > > 
> > > 
> > > (Gettext does assume 1 or 2 plurals for source text, which is one of the
> > > only issues that Gettext has. This means while it supports translating
> > > into
> > > any language correctly, it only supports translating from languages with
> > > 1
> > > or 2 plurals correctly. This is fine in KDE since we're translating from
> > > English, but the issue does exist.)
> > 
> > Below is the error message about not accepting the translation:
> > 
> > Committing transaction...
> > svn: E165001: Commit failed (details follow):
> > svn: E165001: Commit blocked by pre-commit hook (exit code 1) with output:
> > <stdin>:132: a format specification for argument 2, as in 'msgstr[0]',
> > doesn't exist in 'msgid_plural'
> > <stdin>:140: a format specification for argument 2, as in 'msgstr[0]',
> > doesn't exist in 'msgid_plural'
> > msgfmt: found 2 fatal errors
> > 
> > trunk/l10n-kf6/nl/messages/plasma-workspace/kcm_style.po:
> > ERROR: There were syntax errors detected in a po file you committed.
> > ERROR: Please correct them first.
> 
> Okay. As I suspected the problem is the missing %2 in the second string
> which our pre-commit hooks treat as a hard error (probably for a good
> reason). I still think that technically there's nothing wrong with this
> call and it would work if you wouldn't be blocked from committing the
> translation.
> 
> Looks like the code needs to be rewritten with a simple i18nc for the case
> n == 1 and an i18ncp with a dummy n == 1 string.

I have commented on the MR that introduced this change so that it hopefully 
gets fixed soon:
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/
6970#note_1598491

Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 265 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-i18n-doc/attachments/20260902/7abb77ad/attachment.sig>


More information about the kde-i18n-doc mailing list