A notch above a monkey

Look ma', HTML too

This is a second post in hopefully a very short series dedicated to javascript internationalization. If you want, you can read the first one here .

We left off with two supporting functions for striping whitespace and a simple function for translation lookup. Today I added another two functions, one for translating HTML elements and the other for resolving a problem with HTML entities. You can find new javascript here and a demo here .

translateNodes searches for elements with class name i18n, picks up their text content and translates it, if it can find it in translation dictionary. Sometimes it can’t, because what javascript actually sees is a real utf-8 encoded string, where X/HTML entities have been replaced with characters they represent. If this is not true also for source string in dictionary, then there’s a mismatch.

That’s why there’s toEntity function which translates all non-ASCII characters in given string to their entity representation. When translateNodes fails to find translation, it uses toEntity to get a possibly different representation and tries again.

This way you can use entities, which are the only real cross-browser way to describe non-ASCII chars and translations still work. There’s a downside though. Your translation source string must either have all non-ASII characters represented as HTML entities or none of them. Otherwise translation will fail for obvious reasons.

There are planned limitations (like building a system that handles only utf-8 text) and unplanned ones. I still don’t do anything special for strings with significant whitespace (like content of a pre tag) and probably should.

Do nothing = I break it.

It would be nice, if I started to pack this functionality in a more sensible form and build tools that make handling of the whole thing easier.

Next week, which starts in an hour or so, seems perfect time for that.

Update: Follow up here .

Google's bias

Have you ever asked yourself, what’s the purpose of Google’s long living cookie?

Well, others did . I’m not quite as paranoid as some of them, but judging by recent experience it’s definitely used for more than just preferences. I was helping my wife and was looking for term “conventions and scope” , when I’ve noticed that I get completely different answers than she does.

I don’t know about you, but my results are obviously aimed at programmers unlike those of my wife. Google therefore clearly uses their cookie to learn from stuff I searched for about stuff I might in future.

I have no problem with this provided my profile is anonymous. My problem with Google was different. How do I get rid of its bias that normally works in my favor, but every now and then doesn’t?

I know I can turn cookie support off in my browser and that would solve my problem. However, I’m doubtful that many users know this. Should web application offer a way to turn off such bias and if yes, how? Should they reveal it in the first place?

I think they should, but I understand it can be difficult to do so without looking intrusive. That’s why they usually bury it in documents that nobody reads, like terms of use or privacy statements.

Words matter

When we designed Marela , we obviously wanted to make it as close to perfect as possible, but we paid even more attention than usual to words and language used, since I find bad copy consistently the most annoying element of web site design.

This might look odd coming from me. But not being a chef doesn’t mean I can’t enjoy or respect good cooking. So I read articles like this one , hope that more people would do the same and try to do my best. I think we’re doing alright so far; no doubt largely because there are enough capable and caring souls fixing after me my stupidity and sloppiness.

If the tone and words used influence how we feel and percept others in our daily communications, why is it so difficult to imagine that this is equaly true when communicating through a web site or user interface? It’s still communication.

And to make this post at least moderately useful, I give you a short and far from complete list of words used in tech industry and what they actually mean:

  • technology: stuff that doesn’t quite work yet
  • open: works with our stuff
  • robust: works with our stuff, will break with almost anything else
  • quality: works most of the time
  • dynamic: you have to be flexible
  • proactive: active
  • end user: user
  • innovative: average
  • world class: average
  • leading: average
  • cheap: give us lots of money
  • partnership: give us lots of money
  • professional: give us lots of money
  • any 3 or 4 letter acronym: we are smart & give us lots of money