Bug 42293 - Use xgettext with --language JavaScript instead of python
Use xgettext with --language JavaScript instead of python
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Florian Best
Alexander Kläser
: interim-1
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-06 16:18 CEST by Alexander Kläser
Modified: 2017-04-04 18:28 CEST (History)
2 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?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.114
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kläser univentionstaff 2016-09-06 16:18:03 CEST
... this would allow us to use features such as plural forms (Bug 42220) and extracted comments [1] in order to give hints to the translator (Bug 41221).

---------- 8< ---------
cat > test.js <<EOM
// t10n: test
console.log(_('Translate me!'));
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 4 test.po
#. t10n: test
#: test.js:2
msgid "Translate me!"
msgstr ""
---------- 8< ---------

[1] https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
Comment 1 Alexander Kläser univentionstaff 2016-09-06 16:20:02 CEST
Currently management/u-m-c/dev/dh_umc.py calls xgettext with python as language for JS files.
Comment 2 Florian Best univentionstaff 2016-09-06 16:25:38 CEST
(In reply to Alexander Kläser from comment #1)
> Currently management/u-m-c/dev/dh_umc.py calls xgettext with python as
> language for JS files.
Yes, because the current xgettext version in UCS 4.1 doesn't know JavaScript yet. In UCS 4.2 xgettext knows JavaScript.
Comment 3 Florian Best univentionstaff 2016-09-06 17:03:39 CEST
Javascript files are now translated/treated as Javascript language by xgettext. Also --add-comments=i18n has been added.

univention-management-console (9.0.6-1):
r72305 | Bug #42293: use JavaScript as translation language for .js files
Comment 4 Alexander Kläser univentionstaff 2016-09-07 11:19:13 CEST
AFAIS, univention-ucs-translation-template needs also to be adapted.
Comment 5 Florian Best univentionstaff 2016-09-07 11:27:21 CEST
univention-ucs-translation-template (4.0.1-1):
r72345 | Bug #42293: use JavaScript as translation language for .js files
Comment 6 Alexander Kläser univentionstaff 2016-09-07 11:29:03 CEST
I just checked it with the plural form, for this
Comment 7 Florian Best univentionstaff 2016-09-07 11:53:15 CEST
(In reply to Alexander Kläser from comment #6)
> I just checked it with the plural form, for this
Wrong bug, See Bug #42220
Comment 8 Alexander Kläser univentionstaff 2017-01-31 12:41:10 CET
AFAIS, everything works fine. I tested the basic functioning via building modules, the code is now less error prone and works also for modules without JS or Python code (e.g., univention-saml).

I spotted a problem with the translation tests for which I opened Bug 43454.

VERIFIED for now.
Comment 9 Stefan Gohmann univentionstaff 2017-04-04 18:28:52 CEST
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".