World Wide Web - Internationalization

I’m going to Paris France for my vacation this year! I’m very excited about it because I’ve always been a bit of a Francophile. Unfortunately, I don’t speak French so, being a IT professional, I’ve sought a technological solution for the language barrier. I’m not sure that I’ll need to speak any French because I’m going on a guided tour which should reduce my interaction with the locals.

I’ve already blogged about ASP.NET’s support for internationalization and browser languages on my WordPress blog at: ASP.NET 2.0 Culture – Web Site Internationalization. I also blogged about Elgg’s support for languages at Elgg Languages. I’ve done some additional research since then into how PHP supports internationalization and I looked at how all the browsers implement language settings.

Firefox and Opera are the best browsers to use if you are working on making a web site international because they are the only browsers that allow you to indicate the browser language in the user agent string. In Firefox:

  1. To change the browser language type about:config in the address bar and press Enter.
  2. Enter general.useragent.locale in the Filter textbox.
  3. Change en-US to fr-FR or change it back to en-US.

However, I don’t know of a single web site that attempts to detect the browser language by checking the user agent string which will almost always indicate en-US even when your browser language is not set to that. Even with my browser language set to fr-FR, only Google, Microsoft, and Facebook accommodated me with French text. There seems to be some debate over whether it is a good idea to detect browser language settings. Some developers argue that providing content in the appropriate language based on the browser language is the proper way to handle internationalization while others argue that you need to give visitors a means to explicitly change the language using flags because it has become the expected method. In my opinion, you should use both methods because a bilingual visitor will not want to be stuck with the version of the site that matches his browser language settings.

Internet Explorer 8 seems to totally ignore the browser language settings. Even Google appears in English when I set my browser language to fr-FR in Internet Explorer 8. Only Google ignores the browser language settings for Internet Explorer 8. The Safari browser provides no means to change the browser language although you can change the application interface into French by copying the fr.lproj folder over the en.lproj folder. Opera does allow you to change the preferred language for web pages and you can change the user interface language to French by downloading the ouw960_fr.lng file which causes the user agent string to change to: Opera/9.63 (Windows NT 5.1; U; fr) Presto/2.1.1.

The browser language setting is communicated to the web server using the Accept-Language header in each request. In ASP.NET 2.0 you really don’t need to deal with this because the framework has built-in support for localization using the page directives UICulture and Culture. However, if you want to redirect to a page based on the browser language then you can use the following code in your Global.asax file:

   1: Sub Application_Start(ByVal sender As [Object], ByVal e As EventArgs)
   2:         Dim LanguageArray As String() = System.Web.HttpContext.Current.Request.UserLanguages
   3:         If LanguageArray(0).Contains("fr") Then
   4:             System.Web.HttpContext.Current.Response.Redirect("bonjour.htm")
   5:         End If
   6: End Sub

In PHP you can get the Accept-Language header using the server variable $_SERVER['HTTP_ACCEPT_LANGUAGE'];  and then set the locale using  setlocale(LC_ALL, 'fr-FR@euro', 'fr-FR', 'fr-fr');  which will automatically format the date using French for the month names and weekday names. You then need to set the Time Zone using putenv("TZ=Europe/Paris"); to get a 24 hour time in the Central European Time zone. On a Windows server the money_format function will not be available to you so you’ll need to define your own function for that.

But I’ve found a more interesting technological solution for the language barrier. I bought a Pocket PC translator from ECTACO. This device looks like a Pocket PC and it is Microsoft Windows Powered but it is really a highly specialized device with a built-in microphone and large speaker. I’m not sure what operating system it is running but it does not look like Windows Mobile 2003. I think its audio phrasebook may come in handy although it could make an awkward social situation even more awkward. The original SD card did not leave enough room for any additional audio files but I managed to copy everything over to a 2 GB SD card so I could put more MP3s on it.


Find more videos like this on VloggerHeads

No Comments