Small HTML tool that checks JavaScript i18n for completeness

asked 2010-05-07 04:58:51 -0500

Pekka gravatar image

updated 2010-05-07 08:09:38 -0500

While translating the JavaScript i18n messages, I wrote a small tool that checks the arrays in com.cnprog.i18n.js for completeness, and provides an alphabetically ordered template with all necessary words for new translations.

This way, it is easy to keep track what languages a word has already been translated to, and which ones it hasn't yet.

Screen shot:

alt text

It's pure HTML and JavaScript and consists of a .html and a .js file. At the moment, it needs to reside in the /forum/skins/default/media/js directory, though that is easily changed (just modify the paths in the <script> tags).

This could probably be useful for people translating the messages.

Should it be available as download somewhere? Or should it be part of the project? I'll be happy to push it into the repo, but the js directory is probably not the right place for it.

Being a HTML file, it would need to be below the web root. It would be harmless security wise, as nothing dynamic is being done anywhere.

What do you think?

The files can be downloaded here. Just drop them into the /jsdir and call m/default/media/js/org.askbot.output-words.html to see it in action.

This is a quick and dirty tool right now - the HTML is not valid, has no doctype, and it was not tested outside Firefox 3.6!

edit retag flag offensive close merge delete


great. do you mind adding that to the repository? That's ok if the place is not perfect right away, we'll some how repackage it later. Also - you probably notice that the i18n js file is growing big. We'll have to change the way we handle i18n in javascript. Django supports .po for js catalogs.
Evgeny gravatar image Evgeny  ( 2010-05-07 12:23:38 -0500 )edit
last year I took the most obvious approach - just put all strings into one file, but it seems to be no longer acceptable.
Evgeny gravatar image Evgeny  ( 2010-05-07 12:24:27 -0500 )edit
@Evgeny using .po files would be an interesting idea - having all the translation in one place would be great. Otherwise, maybe split them up into multiple files `en.js`, `ru.js` `de.js` could give temporary relief?
Pekka gravatar image Pekka  ( 2010-05-09 03:50:39 -0500 )edit