Univention Bugzilla – Bug 42220
Plural forms cannot be translated properly at various places in the UCS code
Last modified: 2017-04-04 18:30:00 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.
This is more of an advice and can't be fixed without further research or a conversation with a translator.
ucsschool/ucs-school-umc-wizards/umc/js/de.po 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
Another example: ucs/management/univention-appcenter/umc/python/appcenter/de.po 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)
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)); EOM $ 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< ---------
Json files should now be generated correctly from po files with plural forms. svn commit: 72455
(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
Traceback: 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
I fixed comment #6 and comment #7. univention-management-console (9.0.12-5): r72528 | Bug #42220: Fix create_json_file()
The function create_json_file() has raises more specific errors now, catches more errors and got prettified. svn commit: 72885
I prettified the code from comment #9 further, after getting feedback from Florian. svn commit: 72890
Please adjust the workaround for plural forms in univention-management-console-module-udm once the JavaScript code is committed.
The _.ngettext function has been implemented in /management/univention-web/js/i18n.js svn commit: 72925
univention-management-console-module-udm has been adjusted. ngettext() is used multiple times and seems to work correctly. svn commit: 72996
I've further prettified the code after getting feedback from Florian. svn commit: 73006
I found two more typos and fixed them. svn commit: 73108
Created attachment 8092 [details] Proposed translations for the new strings in the umc/js/de.po
Please make sure the package univention-management-console-module-udm can be build for UCS 4.2!
It fails with: dh-umc-module-build .......... done. .................................................................................................................................................................................................................................................................. done. There are plural forms in umc/js/de.po, but no rules in the file's header.
Setting to REOPEN.
The de.po file has been committed, so the package should build now. svn commit: 73248 (de.po) svn commit: 73249 (changelog)
Thank you, yes it did.
Changes: OK, plural forms work in JavaScript nicely Changelog: FAIL, please add a changelog entry for this bug → REOPEN
(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 > > → REOPEN I added the changelog entry [r76786].
svn r73006 introduces the following syntax error: b/management/univention-management-console-module-udm/umc/js/udm/CreateReportDialog.js +» » » » 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.
I fixed several syntax errors due to missing { } brackets. r78428 | Bug #42220: fix syntax errors
UCS 4.2 has been released: https://docs.software-univention.de/release-notes-4.2-0-en.html https://docs.software-univention.de/release-notes-4.2-0-de.html If this error occurs again, please use "Clone This Bug".