Skip to content
AndyStricker edited this page Aug 16, 2011 · 9 revisions

Home

Gettext with Javascript source support

This is a fork of the official Gettext repository at GNU Savannah

Goal

The idea is to enable xgettext to parse Javascript files. For runtime support have a look at Javascript Gettext

What works

This currently supports parsing of Javascript source files. It recognize Javascript comments and strings correctly. It allows string literals that are concatenated with the plus ‘+’ operator.

It won’t be irritated by regular expressions containing string quotation characters anymore.

The code has been tested on a few huge Javascript application with more than 80’000 lines of source code.

The code has been installed with MacPorts

What is missing

I’m still trying to get the code into upstream. From time to time or on your request I merge changes from master into Javascript to keep it recent.

I’ll like to get bug reports if the parser swallows up on a piece of code to make it more reliable.

There are many different Javascript libraries with different format string variants. I didn’t have found a common base until yet but left the C format string parser.

I don’t know if it works with other charsets than UTF-8, I’m not interrested in any other charset support.

What else is to do

The code is copy&paste of the Python parser. The Python Parser is partly copy&paste of the C parser. At least the unicode parsing part should be shared between the parsers. The code is too huge to be long term maintainable.

Projects based on this code

There is a jQuery plugin project for gettext support