[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gettext] JavaScript support status
From: |
Markus Gothe |
Subject: |
Re: [bug-gettext] JavaScript support status |
Date: |
Wed, 21 Dec 2016 19:49:07 +0100 |
Hi, as far as I am concerned I build embedded systems. Slow CPUs and no FPU so
to get a responsive UI we use JQuery. We've customised the httpd to do regexps
on all text to make sure one cannot use what are considered "unsafe
characters". Letting the backend do all translation would be really slow.
So here is my setup:
1 mo file containing UI and application translations. CGI-scripts also use this
one.
In /etc/rc we run mo2json on the file and create a json object in memory since
we have lots of constraints it works better to do this at runtime.
Then JED.js use this to do the translations on the DOM tree in the browser.
Today I created npgettext so we can use different contexts for different
cgi-scripts.
We have a script based on our inhouse-made html2po.py and xgettext. Actually
Python as language works better than the JS parser.
Hope you guys get a grip of what I am up to. :-)
BR,
Markus Gothe
Sent from my BlackBerry 10 smartphone.
Original Message
From: Bruno Haible
Sent: onsdagen den 21:e december 2016 18:34
To: Daiki Ueno; address@hidden
Cc: Markus Gothe
Subject: JavaScript support status
Hi,
I'm trying to get an understanding of:
- What is the JavaScript community doing w.r.t. localization and PO and MO
files?
- What can/should the GNU gettext package do in order to be useful for this
community?
Here's a set of packages and use situations I could find. It does not give a
big picture to me. Can someone shed some light on anything of this, and
clarify?
========================== Package in/for JavaScript ==========================
JavaScript libraries:
* gettext-js
https://code.google.com/archive/p/gettext-js/
2007-2009
API: A global Gettext object.
Implementation: Uses PO files by parsing them.
Depends on Prototype.js.
* jsgettext
https://sourceforge.net/projects/jsgettext.berlios/
https://github.com/adrienrn/jsgettext
https://bitbucket.org/fanstatic/js.jsgettext
http://jsgettext.sourceforge.net/
2008-2011
API: A global Gettext object. See
http://jsgettext.sourceforge.net/doc/html/Gettext.html
Implementation: Uses PO files by parsing them.
* JQuery Globalize
https://github.com/globalizejs/globalize
2010-2016
Uses just JSON, no PO or MO files so far
* jed
https://github.com/messageformat/Jed
http://messageformat.github.io/Jed/
https://alexsexton.com/blog/2012/10/introducing-the-jed-toolkit/
http://www.2ality.com/2012/11/jed-toolkit.html
http://www.jeromesteunou.net/internationalisation-in-javascript.html
2012-2016
* gettext-js based on jed
https://www.npmjs.com/package/gettext-js
https://github.com/frascata/gettext-js
2016
* angular-gettext
https://angular-gettext.rocketeer.be/
https://github.com/rubenv/angular-gettext
2013-2016
API: An Angular module.
Implementation: Uses JSON files created by
https://github.com/rubenv/angular-gettext-tools
Depends on Angular.
* angular-translate
https://github.com/angular-translate/angular-translate
2013-2016
?
* gettext.js
https://github.com/ojii/gettext.js
http://gettextjs.readthedocs.io/en/latest/
API: minimal
Includes a MO -> JSON converter:
https://github.com/ojii/gettext.js/blob/master/src/py/gettextjs.py
2015-2016
"Toolkits":
* http://i18next.com
Integrated in web frameworks:
* Babel
https://babel.edgewall.org/
https://babel.edgewall.org/wiki/Documentation/messages.html
also supports JavaScript
API: ?
Implementation: ?
* Django
https://www.djangoproject.com/
https://docs.djangoproject.com/en/1.10/topics/i18n/translation/
Lexer: https://github.com/django/django/blob/master/django/utils/jslex.py
2011-2015
Implementation: Uses .mo files
Uses "wrappers around xgettext and msgfmt", "for convenience".
* django-jsgettext based on Django
https://github.com/niwinz/django-jsgettext
2012-2013
Converters PO -> MO
* https://www.npmjs.com/package/gulp-gettext
https://github.com/cloud-walker/gulp-gettext
2015-2016
Converters MO -> JSON
* https://github.com/jakob-stoeck/jpoker/blob/master/mo2json.py
2008
* https://github.com/wrook/jquery.gettext/blob/master/mo2json.py
2009
=============================== Use situations ===============================
JavaScript runtimes:
- Browsers
- Node.js (a.k.a. "server-side JavaScript")
- gjs (command-line, but linked to Mozilla's JavaScript) [who uses that?]
================================= Status quo =================================
What is currently implemented in GNU gettext?
- xgettext support for jsgettext package.
- A test case lang-javascript. Based on the gjs gettext module.
- There is no hello-javascript.
Bruno