Localization support for language identifier

Something’s wrong when a language identifier doesn’t have localization support. So I cooked up a little localization code for What Language Is This?, which proved to be not as easy as one might guess. That’s because some of the textual content of the web app is in HTML, other is generated by PHP, and yet other is generated in JavaScript. I wanted to have one single source of localized strings for all three output paths to simplify overviewing, translating, changing, and adding strings to the web app.

I’m not sure if there’s any good solution for this out there, but I cooked up my own. Each language translation has its strings in a text file formatted like an ini file with id keys and localized strings separated by an equals sign. You can view the English and Japanese raw text files if you like. These are read into a PHP array (i.e. dictionary), after first looking at what language is specified by the URL (/en for English, /ja for Japanese or any other code), and if that is not specified then looking at what languages the browser is set to prefer via the Accept-Language HTTP header. If the requested language is not available then default to English.

To get the html output localized, the php script that reads through and configures the app (the plain html file itself is set up to run offline for debugging purposes only) looks for string ids enclosed in percent signs, i.e. like %strings id%. These are then replaced with the localized strings from the dictionary. The php-generated content is trivially changed to look up strings from the dictionary. On the JavaScript side, I wanted access to the same string dictionary that I had on the php side, so this is inserted into a <script> block of the generated html output as a JavaScript object (i.e. dictionary). String id lookups can then be done on this object from the JavaScript code just like on the php side. In other words, the php string dictionary is converted into JSON, which is used from the JavaScript side.

あれ何語? What Language Is This? in 日本語

あれ何語? What Language Is This? in 日本語

It all works pretty well and meets my goals. The only downside is that it relies on the server to do some processing, so when I develop on the offline version the strings aren’t available, instead I get to see the raw string ids, which can be useful too, but you have to rely on imagination to envision the end result. Isn’t programming always like that anyway, though?

The first translated version of What Language Is This? is of course Japanese, done by myself and my wife (初めての共同作業? lol), not just because it’s easy for me to do, but also because when looking at the AddThis stats, Japan is the top ranking country, and also as you know the average English skills in Japan are pretty bad, so I suspect there is a demand for a Japanese translation. Looking at the access stats, and discounting those with good English skills (India, Netherlands, Scandinavia, for example), next in line would most likely be Spanish, French, and German, in that order. Anyone feel like helping? Please drop me a comment in that case. I can offer proper credit and a link back from the site in return.


More Dravidian language identification

Lately, What Language Is This?, the web-based language identification tool I’m running, has been getting many hits from Tamil-language sources, probably as a result of being covered in two seemingly popular blogs, techintamil.blogspot.com, and tamilnenjam.com. As another blogger pointed out,

Also this service is very good at identifying indic languages (where as many other services fail to understand).

Well, thanks. And yes, I have been making sure that the languages of the Indian subcontinent and its surrounding areas are thoroughly supported for identification.

But two notable languages have been missing, and I finally got around to adding them. Namely the two Dravidian languages Malayalam (not to be confused with Malay, to which it is unrelated) and Kannada (not to be confused with Canada, to which it is unrelated).

Together with the already supported Tamil and Telugu, this means that all four literary Dravidian languages are supported now! I hope this will be of use to many, and I’d like to thank the Dravidian-speaking bloggers for their support in the form of writing about the site.


Japanese for programmers (and software developers)

After literally years of gathering materials and many full days of writing work, I’ve finally published my page on technical and business Japanese for software professionals (code monkeys) looking for a job in Japan or already working in Japanese companies or with Japanese clients who want to improve their programming Japanese.

The page consists of basically three main parts: Essential Japanese programming vocabulary, Expressions for communicating technical issues in Japanese (with a Part II), and A look at a Japanese software specification. They’re based on material I’ve gathered during my years working in Japan, mostly in completely disorganized, scattered text files, so collecting and choosing the useful bits of it for this page was more work than it should have been…

Actually, I first got the idea of writing a “Japanese for Programmers” book some time ago when talking with a former colleague. The idea was that there are so many especially Indian software developers working in Japan, but there are as yet no books aimed specifically at this segment, and there should be a huge market.

Anyway, I’m an avid reader of Seth Godin’s blog, and Seth is the guy behind Squidoo as well, so I naturally stumbled upon it. I gave it a go, and it’s actually a really fun and easy way to create modern, stylish, SEO’d web pages without having to bother with the technical issues.

And then in last month’s search queries used to find my site I saw “japanese speaking programming“, and that finally got me going to do something with my Japanese for Programmers idea – I mean people are searching for it, and they’re already finding my site from it (there’s no “Japanese for Programmers” site on the net anyhow!), despite me not specifically covering that topic, so it seems everything falls into place. And thus the Japanese for Programmers Squidoo “lens” was born!

So I hope it’ll get lots of readers and comments. I still have loads more material, so if it gets popular I might do a follow up. :-) Here’s the URL again:

http://www.squidoo.com/japanese-for-programmers