Bug 42220 - Plural forms cannot be translated properly at various places in the UCS code
Plural forms cannot be translated properly at various places in the UCS code
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Richard Ulmer
Alexander Kläser
: interim-1
Depends on:
Blocks: 41221
  Show dependency treegraph
Reported: 2016-09-01 15:05 CEST by Richard Ulmer
Modified: 2017-04-04 18:30 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
Who will be affected by this bug?: 5: Will affect all installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.057
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Internationalization
Max CVSS v3 score:

Typos with .po files and descriptions (417 bytes, text/plain)
2016-09-01 15:05 CEST, Richard Ulmer
Proposed translations for the new strings in the umc/js/de.po (67.90 KB, text/x-gettext-translation)
2016-10-12 16:46 CEST, Richard Ulmer

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Ulmer univentionstaff 2016-09-01 15:05:22 CEST
Created attachment 7970 [details]
Typos with .po files and descriptions

+++ This bug was initially created as a clone of Bug #42213 +++

Attached some collected feedback regarding text typos from partners.
Comment 1 Richard Ulmer univentionstaff 2016-09-02 14:25:08 CEST
This is more of an advice and can't be fixed without further research or a conversation with a translator.
Comment 2 Alexander Kläser univentionstaff 2016-09-06 12:18:38 CEST
No %(objPlural)s could be found
(Such constructs assuming a plural bring translation problems.
First, some languages use more than two plural forms - Russian, Bosniac, Irish, etc.
Second, "No" in English is translated to "Aucun" in French, and "No" is followed by plural and "Aucun" by singular!
Better use support for "plural forms" as offered by gettext utilities.)

See also: https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
Comment 3 Alexander Kläser univentionstaff 2016-09-06 12:20:38 CEST
Another example:
some ->
	(please don't use combinatory translations like this one.
	in French, it's not the same translation when it refers
	to masculine or feminine words)
Comment 4 Alexander Kläser univentionstaff 2016-09-07 11:32:39 CEST
With Bug 42289 being fixed, we can use plural forms. However, for this we will need the plural function ngettext. Then we can use plural forms, e.g.:

---------- 8< ---------
$ cat > test.js <<EOM
// t10n: test
console.log(_('Translate me!'));
console.log(_.ngettext('%d thing', '%d things', n));

$ xgettext --force-po --from-code=UTF-8 --sort-output --package-name=test \
  --language JavaScript --add-comments=t10n -o test.po test.js

$ tail -n 11 test.po
#: test.js:3
#, javascript-format
msgid "%d thing"
msgid_plural "%d things"
msgstr[0] ""
msgstr[1] ""

#. t10n: test
#: test.js:2
msgid "Translate me!"
msgstr ""
---------- 8< ---------
Comment 5 Richard Ulmer univentionstaff 2016-09-09 10:44:00 CEST
Json files should now be generated correctly from po files with plural forms.

svn commit: 72455
Comment 6 Florian Best univentionstaff 2016-09-12 13:42:47 CEST
(In reply to Richard Ulmer from comment #5)
> Json files should now be generated correctly from po files with plural forms.
> svn commit: 72455
Missing import of 're' module in dev/dh_umc.py
Comment 7 Florian Best univentionstaff 2016-09-13 10:36:54 CEST
File "/usr/lib/pymodules/python2.7/univention/dh_umc.py", line 359, in create_json_file 
    data[entry.msgid] = tmp_lst
UnboundLocalError: local variable 'tmp_lst' referenced before assignment
Comment 8 Florian Best univentionstaff 2016-09-13 10:48:47 CEST
I fixed comment #6 and comment #7.

univention-management-console (9.0.12-5):
r72528 | Bug #42220: Fix create_json_file()
Comment 9 Richard Ulmer univentionstaff 2016-09-28 16:02:09 CEST
The function create_json_file() has raises more specific errors now, catches more  errors and got prettified. 

svn commit: 72885
Comment 10 Richard Ulmer univentionstaff 2016-09-29 09:52:06 CEST
I prettified the code from comment #9 further, after getting feedback from Florian.

svn commit: 72890
Comment 11 Alexander Kläser univentionstaff 2016-09-29 13:41:28 CEST
Please adjust the workaround for plural forms in univention-management-console-module-udm once the JavaScript code is committed.
Comment 12 Richard Ulmer univentionstaff 2016-09-30 11:21:43 CEST
The _.ngettext function has been implemented in /management/univention-web/js/i18n.js

svn commit: 72925
Comment 13 Richard Ulmer univentionstaff 2016-10-07 13:20:40 CEST
univention-management-console-module-udm has been adjusted. ngettext() is used multiple times and seems to work correctly.

svn commit: 72996
Comment 14 Richard Ulmer univentionstaff 2016-10-07 14:51:11 CEST
I've further prettified the code after getting feedback from Florian.

svn commit: 73006
Comment 15 Richard Ulmer univentionstaff 2016-10-12 16:43:37 CEST
I found two more typos and fixed them.

svn commit: 73108
Comment 16 Richard Ulmer univentionstaff 2016-10-12 16:46:55 CEST
Created attachment 8092 [details]
Proposed translations for the new strings in the umc/js/de.po
Comment 17 Florian Best univentionstaff 2016-10-13 18:57:37 CEST
Please make sure the package univention-management-console-module-udm can be build for UCS 4.2!
Comment 18 Florian Best univentionstaff 2016-10-13 18:58:16 CEST
It fails with:
.......... done.
.................................................................................................................................................................................................................................................................. done.
There are plural forms in umc/js/de.po, but no rules in the file's header.
Comment 19 Alexander Kläser univentionstaff 2016-10-14 11:54:17 CEST
Setting to REOPEN.
Comment 20 Richard Ulmer univentionstaff 2016-10-14 15:50:40 CEST
The de.po file has been committed, so the package should build now.

svn commit: 73248 (de.po)
svn commit: 73249 (changelog)
Comment 21 Florian Best univentionstaff 2016-10-17 10:39:35 CEST
Thank you, yes it did.
Comment 22 Alexander Kläser univentionstaff 2017-02-16 15:40:50 CET
Changes: OK, plural forms work in JavaScript nicely
Changelog: FAIL, please add a changelog entry for this bug

Comment 23 Alexander Kläser univentionstaff 2017-02-17 10:31:12 CET
(In reply to Alexander Kläser from comment #22)
> Changes: OK, plural forms work in JavaScript nicely
> Changelog: FAIL, please add a changelog entry for this bug

I added the changelog entry [r76786].
Comment 24 Florian Best univentionstaff 2017-03-20 13:27:49 CET
svn r73006 introduces the following syntax error:

+»   »   »   »   var text = lang.replace(_('The {type} can be downloaded at<br><br><a target="_blank" href="{href}">{obj}</a>'),
+»   »   »   »                           {type, href, obj});

I will fix this in Bug #43751.
Comment 25 Florian Best univentionstaff 2017-03-28 15:12:19 CEST
I fixed several syntax errors due to missing { } brackets.

r78428 | Bug #42220: fix syntax errors
Comment 26 Stefan Gohmann univentionstaff 2017-04-04 18:30:00 CEST
UCS 4.2 has been released:

If this error occurs again, please use "Clone This Bug".