Andy's insights

Opinions, thoughts, archivements

Wed, 21 Apr 2010

Javascript scanner for xgettext

I’ve spend quite a few hours to build Gettext support into our huge Javascript application at work. One missing part was a Javascript scanner for the xgettext command.

After looking into the source I decided to extend the Gettext utility by myself. (After all I read the Dragon Book ).

It was quite simple to build a Javascript scanner module based on the existing Python scanner. All scanners don’t try to fully parse the source code but to only parse as much as needed to divide comments from code and identify the gettext function calls (_("...")) and extract it’s argument(s).

The first version already ran through our code base of about 40k lines without any errors. But running it on another project revealed that I need also to identify regular expression statements like /a"b'c/. If the RegExp statement contains unbalanced string quotation marks (’ or “) then the scanner barks and misses following translateable strings. So I spend more time fixing those special cases. The scanner is now ready to test in production environments.

My next step is to port back the current code to 0.17 and fix the symbol error in this backport that prevents to compile it on ELF based systems.

If you are interrested, the module can be obtained from my public GIT repository at github:

http://github.com/AndyStricker/gettext-javascript

I’m still trying to get it upstream into the gettext distribution. So far I got no reaction, but I’m patient. At least other possible users asked my about this new feature.

posted at: 23:41 | path: /development | permanent link to this entry

Sun, 18 Apr 2010

New Webserver

This page is now running on a new webserver.

As all my services this runs now within a virtual machine within my home server I’m describing in my Knowledge Base

It’s a Apache based webserver, running Pyblosxom and a MoinMoin wiki using mod_wsgi The whole Webserver has no PHP and no database. This simplify setup and mainenance.

For both the blog and the wiki I added a uniform theme. For both, the theming was very easy but a assiduity work. And if you wonder: I just write HTML and CSS as standardized by W3C . I’ve no idea how this looks in IE(Internet Explorer), I don’t bother.

posted at: 23:13 | path: /news | permanent link to this entry