Wednesday, February 18, 2009


...since I'm going to have to speak Spanish in Alhambra, CA during the AT&T work stoppage... I might as well incorporate that into my web applications and "make lemonade" as the saying goes.

That's just a positive spin on having to go there. We coincidentally have homework due next week related to internationalization.

Been writing the Depot app via the PragProg book in Rails, but am doing so via Test Driven Development (slightly different from the book, per the awesome teaching of @tenderlove in the UWRails class -- this is the 2nd time I've taken this 3 month Rails class, and learning a ton more about Rails 2.2 and especially TDD)... am getting to the part where I'm incorporating internationalization.

I like this i18n features built into Rails, so I figured I'd blog about it, in case anyone else was interested: so certain items have translations. E.g. headers, titles, shopping carts, buttons, links -- not the data in the database, but all the labels and text that would help a user navigate through the application.

The translations are handled in a YAML file, which lets you call out the translation that matches it's hierarchy -- as shown below (Spanish, "es" shown here, there is an accompanying translation file for English, or "en"... could continue on as many languages as you wanted):

So the user sets their language preference via the dropdown (English is default, but they can choose whatever they want), then voila all labels that have a translation appear in that language selected! How does that work? Inside the code for all the pages, it just effectively says "give me whatever language is selected for layout.side.home, etc., and looks it up in the YAML file for that language above, grabs the matching value in that hierarchy, and out pops the word or phrase. For example, the markup for the sidebar links for "store", "questions", "news", "contact" look like this:

This is a common example, and almost identical to the example in the PragProg Agile Rails version 3 book -- maybe armed with this knowledge, I'll internationalize EyeOnMajors and Golfap as soon as it is riding on the Rails... :)


Sunday, February 08, 2009

Get Satisfaction -- customer dialogue

An example of what I'm using for EyeOnMajors to elicit customer feedback, ideas, etc.

Tuesday, February 03, 2009

forcing repaint DOM in IE6 and IE7?

I have loop that makes server-side Ajax calls on each iteration, and returns data. This could be 50 iterations, 500, 5000, whatever. Upon each iteration, I update that particular row with a server-side response (i.e. "success" or "fail"), and then update the total count processed ("26 out of 432 processed"). -- I update the innerHTML of a div or span, and another div showing the total number of records processed (at the end of an iteration, or in the onComplete callback handler of the Ajax.Request). That is all working perfectly fine... in Firefox, Safari, and every other browser except IE6 and IE7.

I have tried IE hacks such as adding a class to the div, and dropping a class from the div, adding and dropping child nodes from the div, etc -- to attempt to force IE to repaint, I have tried waiting a small interval, to no avail. If you pop up an alert("hai"); at the end of the iteration, the the IE6 and IE7 DOM will repaint with the updated values. (btw, how dumb is that?)

Does anybody have any tried and true ways to make IE6 or IE7 repaint a particular DOM element in these cases (without obviously popping an alert)? It works flawlessly in Firefox. I know IE is a steaming pile, but just wondering if anyone has had any success with a hack that works here.