Ask Your Question
1

Small HTML tool that checks JavaScript i18n for completeness

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

Pekka gravatar image Pekka
550 22 28 37

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!

delete close flag offensive retag edit

Comments

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 ( 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 ( 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 ( 2010-05-09 03:50:39 -0500 )edit

Be the first one to answer this question!

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow

subscribe to rss feed

Stats

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

Seen: 504 times

Last updated: May 07 '10