mixed plural form handling
schwarzer at kde.org
Sat Apr 22 14:16:24 BST 2023
today I was nudged from this:
"Script kiddy generates endless daily commits that add and remove brackets"
What happens there is that the PO files sometimes have parens around the plural condition and sometimes they do not, resulting in commits like this (back and forth):
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
Since it seems only the German translation is affected, I started looking into what is happening and now I wonder why this is not a more wide spread issue.
What I found:
- Scripty "check_po_files" removes parens from plural
- gettext "msginit" creates PO files with parens in the plural condition when run like this:
msginit --locale=de_DE.UTF-8 --no-wrap --no-translator --input=file.pot --output-file=file.po
So what happens is that I create missing PO files with msginit and introduce the parens in the summit folder. After that, "summit scatter" adds the parens to the PO files in the branches folders (l10n-kf5, l10n-kf6 ...) and then Scripty removes the parens. Then I add them again with scatter, then Scripty removes them again. Neverending story. Scripts against script.
When I search the Web, I find collections of plural forms sometimes with the parens, sometimes without.
nplurals=2; plural=(n != 1);
de German 2 n != 1
... just to name two. I guess, then, there is no right or wrong here but just "what we do".
I would gladly just call "msginit" differently if it had a command line switch for that but I cannot find one.
So, how do other teams create missing PO files? I know it works with Lokalize (not sure if it uses parens then or not) but I prefer to do it with a script.
Thanks for any advice.
More information about the kde-i18n-doc