Languages are a means to an end, a journey as well as a destination

I recently wrote an op-ed for the Seattle Times about the importance and value of thinking globally. Here’s an excerpt:

Consider Starbucks. In 2003, this aspiring global company supported a mere three languages. Today, it supports 25, which may sound like a lot until you compare it to many other global brands. Among the leading global brands, the average number of languages supported is 31, a new high based on my years of research. And then there are those companies that left 30 languages behind years ago — like Facebook, which supports more than 90 languages, and Google, which supports more than a hundred.

This degree of language growth isn’t just a tech phenomenon. John Deere supports 31 languages, Ford supports 42, and even Jack Daniels is fluent in 22 languages.

So while the U.S. leaders are speaking the rhetoric of isolationism, American companies of all sizes are speaking a different language — in fact, a lot of languages.

And here’s the full article.


How to localize date formats using Globalize.js

Dates are often used as case studies to illustrate the risks of ignoring cultural differences. For example, the date 4/7/2011 could be taken to mean July 4th by some and April 7th by others.

Fortunately, the open source JavaScript library Globalize provides a relatively easy way of delivering properly formatted dates (and other culture-specific data types) to users anywhere around the world.

In this article, I will show you how JavaScript’s built-in functions may be used to display dates and their inherent limitations and inconsistencies. I will then turn to Globalize to avoid these issues.

The not-so-simple approach to dates

Using the toString, toDateString or toTimeString

The simplest way to write a Date value would be to use the toString method, such as today.toString(). It produces, by definition, a system-defined presentation of the date.

In practice, you get some English-language notation, such as “Sat Jul 04 2015 13:30:50 GMT+0300,” independently of the language of the page, or the browser, or anything. However, browsers may try to localize the time zone denotation in their own ways. The code document.write(new Date(2115,6,11)) gives different results based on different browsers. The following examples are from browsers on a Finnish version of Windows 7 Pro:

Internet Explorer: Thu Jul 11 00:00:00 UTC+0300 2115
Firefox: Thu Jul 11 2115 00:00:00 GMT+0300 (Suomen kesaaika)
Opera: Thu Jul 11 2115 00:00:00 GMT+0300
Chrome: Thu Jul 11 2115 00:00:00 GMT+0300 (Suomen kes�aika)
Safari: Thu Jul 11 2115 00:00:00 GMT+0300 (Suomen kesäaika)
Android: Thu Jul 11 2115 00:00:00 GMT+0300 (EST)

So three of the six browsers write the time zone using a name in the language of the underlying operating system. Only Safari gets it right; Firefox and Chrome mess up the letter “ä” in two different ways.

The best we can say about the toString method for Date is that it produces some human-readable presentation of the moment of time. The presentation is widely understood, but far from universally. It would not look good on a page otherwise in Greek, Chinese, or Thai.

Similar challenges apply to using the methods toDateString and toTimeString.

Beware of implicit Date toString conversions

In JavaScript, toString() often gets applied implicitly. For example, if the value of foo is a Date object, then any of the following statements causes a call to toString:

document.getElementById('x').innerHTML = foo;
foo = foo + '';

Automatic conversion to strings are often a convenience, and many authors routinely make use of it, perhaps even without ever thinking about it. Thus, it is not always obvious from the code where data gets written in a manner that should be modified when localizing software. The convenience of automatic operations in JavaScript has drawbacks, too. The implicit conversion (or coercion) means that general, non-localized toString() methods are used.

The deceptive toLocaleDateString

It would be natural to expect that the toLocaleDateString method produces a localized presentation of the date, and it does. But, as a developer, the locale is beyond your control. Little does it help to have the date localized in Swahili when it should be in Arabic.

You may also get essentially different results on different browsers even with the same system. For example, writing a date on a Finnish Windows operating system, with user interface language set to French, I get:

Internet Explorer: dimanche 1 juillet 2012
Firefox: 11. heinäkuuta 2012
Opera: 11/07/2012

Globalize to the rescue

To localize the display of Date values, you could override the built-in toString method. For that, you would need code that converts a Date value to a localized string in a format that is suitable for the target locale.

Using the Globalize library, this would be easy:

Date.prototype.toString = function() {
return Globalize.format(this,'F'); }

This example uses a full-length (‘F’) format, which contains all of the date information. In many contexts, it would be better to display only subsets of this information, such a short date. To get more granular control, we need specific presentation formats, which we cover in more detail in Part II. But this code is an effective and lightweight way to protect against accidental non-localized writing of Date values.

Now suppose you have written, say, var today = new Date() in JavaScript. How would you display the date in a format that is understandable and unambiguous to the user? Let us first assume, for simplicity, that we know that the user is German-speaking and that a “long” or “full” format is to be used for the date.

Using the Globalize library, you could write the following:

<!doctype html>
<title>Globalize demo<title>
<meta charset=utf-8>
<p id=date></p>
<script type="text/javascript" src="globalize.js">

In the example above, the first two script elements are needed to refer to external library files. The files are assumed to reside in the same folder as the page, so that you can use just filenames as URLs. The files referred to can be downloaded via the Globalize page at GitHub. The page address still reflects the old name “jQuery Global” of the library, but the Globalize library is now totally independent of jQuery, though it reflects same general idea “write less, do more.” Using Globalize by no means excludes using jQuery, but neither does it require it.

The code uses the “plain” way of accessing an element with getElementById() and setting its innerHTML property. If you are used to jQuery, you would probably want to replace the assignment with a shorter construct:


Depending on the actual date, the web page would display:

Mittwoch, 25. Mai 2011

And you didn’t need to know a single word of German to produce this text string.

Article excerpted from Going Global with JavaScript and Globalize.js by Jukka Korpella.

Google vs. Baidu: A User Experience Analysis

There are tons of articles about Google vs. Baidu, but few of these articles take an in-depth look at how Google compares to Baidu from a Chinese user’s perspective.

In this article, I do just that, and I render a verdict as to which Web site is better.


The best way to compare search engine quality is to compare searches.

I recently input three Chinese keywords for my experiment:

  • 许霆 (Xu Ting: A Chinese citizen who was recently involved in a controversial criminal case)
  • 次级房贷 (Subprime mortgage)
  • 看羹吃饭 (Kan-Geng-Chi-fan: A phrase used and recognized by a relatively small number of Chinese, meaning that you have to think carefully before taking action)

These keywords represent three different categories of information people search for online. Xu Ting is a hot keyword in China at the moment but it has received little international media coverage. Subprime mortgage, on the other hand, is a foreign concept and the term has been transliterated into Chinese characters from the English equivalent. Kan-Geng-Chi-fan is used within a specific dialect that is not used by the majority of Chinese citizens.

Okay, here are the results as of April 18, 2008:

“Xu Ting”

It would seem that Baidu knows much more about Xu Ting than Google, although I did not verify that every result referred to this particular individual.

Interestingly, in the first results page of both and, one of the search results directed users to Baidu Post — Baidu’s popular user forum.

Overall, I would rate both sites equally because the top 20 results from each search engine were highly qualified and I could easily find information I wanted from there. Verdict: A tie.

“Subprime mortgage”

This time appears to do much better than Baidu. But if we look closely at the top 20 search results, we’ll find there are 7 results at and 5 results at that direct us to Web sites that use traditional Chinese characters, which are used in Taiwan, Hong Kong and by the overseas Chinese community.

It can be rather challenging for the mainland Chinese to read traditional Chinese, though they can understand most of the message. Nonetheless, this mix of simplified and traditional Characters is not the most user-friendly approach. Verdict: Baidu wins.

“Kan Geng Chi Fan”

At first glance, Google produced overwhelmingly more information than Baidu. However, if we examine the details, Google did not perform so well. Neither nor produce an accurate search result within the first 10 pages respectively, while all the 207 search results from Baidu are accurate. Verdict: Baidu wins again.

Based on these three searches, Google comes across as a bit complicated and “foreign” to Chinese users. Baidu is the superior Chinese search engine.


Both Google and Baidu are trying to leverage their network effects to promote other products. Google has many excellent products, but not every product has performed well in China. For example, Google Maps is widely used by American users. Unfortunately, Google Maps in China is unable to provide the same features due to unavailability of mapping data in China. Google’s satellite map currently only covers the major Chinese cities. Should Google acquire better maps, it would have a clear advantage over Baidu, which doesn’t offer the same degree of functionality and usability in its map tool.

Although music copyright is a controversial issue within China, the market reality is that millions of Chinese Internet users download free music online. Baidu understands this reality and its music search product — which presents a list of links for free music downloads when people search by song, singer, or label — is extremely popular. Google is unable to compete with Baidu in this regard due to its adherence to US copyright laws.

Another example is Baidu Post, an online forum allowing Internet user to create new topics based on search keywords and provide commentary. When people search online by keyword, they can also follow these keywords to Baidu Post, where they may find additional information — or at least find out what others think of the selected keywords.

Online forums are a very important medium in China for distributing information online. I think an important reason for this is because the Chinese, as well as many businesses, want to remain anonymous. While this may change in the years ahead as the next generation embraces social networking sites, for the time being, online forums are dominant. Baidu also offers a blog platform (Hi Baidu) while Google has localized Blogger into Chinese, very few Chinese people currently use it.

Local culture and consumer behavior are critical factors in determining whether a product will succeed in an overseas market or not. So far, Google products have not been as appealing as Baidu to Chinese users.

The Brand Name

The name of Baidu (百度) is from a beautiful Chinese ancient poem:

Thousands of times, I looked for my girl;

Suddenly, at some point, I stopped and looked back,

I found she was just over there among a bunch of lanterns.

This poem, written by Qiji Xin, who lived in the Song Dynasty nearly 1000 years ago, is still very popular in China and also taught in high schools. Baidu in Chinese means thousands of times. In Chinese culture, this poem communicates one’s desire to achieve his/her dreams. Obviously, meshes well with the services offered by Baidu, a company that claims it better understands Chinese users and Chinese culture.

Google started to use its Chinese name Guge (谷歌) in 2006. Guge (goo-ge) is transliterated from Google and it literally means “the song of grain” in Chinese. A survey conducted in 2006 shows 84.6% Chinese do not like this name. I think the most important reason is that Chinese people want to feel international and modern. This is also one reason you may see many Chinese companies using English words in their marketing materials, as it creates an international effect. The “song of grain” presents an image of the agricultural society that the Chinese people are striving to break away from.

Google has exerted a good deal of effort in localizing its name for China but it has not yet been accepted by the Chinese people. It may take some time. Some companies have chosen to simply use their English names in China, avoiding localization altogether, such as IBM.

To sum up, Baidu definitely has an edge over Google in China. But it is early yet and Google has been doing things such as redesigning its Chinese home page, which may resonate with users. The key takeaway here is that every new market is a new challenge; just because you are number one at home does not mean you will be number one in every country you enter. Should Baidu enter the US market some day, it will face many of the same challenges that Google is now facing in China.