Create Multilingual QR Code for your Website

by Preetha 2012-09-13 16:50:09

Multilingual QR Codes Detect Phone's Language
Wikipedia unveiled a new tool called QRpedia that adds language-detection capabilities to these static QR codes.
Now when a user scans a QR code image for a Wikipedia article, the code detects the default language of the mobile phone and automatically redirects him to the Wikipedia article in that language.

Add Multilingual QR Codes to your Website
In case you would like to add Wikipedia style language-detection QR codes to your own web pages, here's the relevant JavaScript code. Just copy-paste this snippet into your website template where you would like the the QR code image to appear and the code does the rest.

1
2
3
4
5
6
<script language=javascript>
var esc = window.encodeURIComponent ? window.encodeURIComponent : escape;
var url = 'http://ctrlq.org/qrcode/l/?l=en&u=' + document.location.href;
var cht = 'http://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=' + esc(url);
document.write("<img alt='QR Code' src='" + cht + "' />");
</script>
If your website content is in a language other than English, change the "en" value (highlighted in yellow) to your language code. Also, the above code generates a 200*200 image but you may change the default values (highlighted in green) to something else that suits your site's layout.

Language Detection and Language Translation
To test this QR code, go to your phone settings and change the default locale to español or français or anything other than English. Now scan the QR code image above and it should open this blog but only after translating it from English to your phone's language.

Here's what happens behind the scenes. The language detection part is handled by the QR code URL - it determines the user's phone language after reading the request header sent by the mobile browser and then redirects the user to to translated page. The language translation is handled by Google Translate while the QR image itself is generated using the Google Charts API.

Tagged in:

790
like
0
dislike
0
mail
flag

You must LOGIN to add comments