jQuery Rotate Through Other Languages


jQuery code snippet to show other languages link (say in the footer) of your web page. It randomly shows other languages available with a link to change the language of the website. It is set to change every 5 seconds but this can be optimised as well as the array of languages displayed.

jQuery Code

(function (b) {
	var c = ['العربية', 'Ελληνικά', 'Polski', 'Bosanksi', 'Bahasa Indonesia', 'Русский', '中文', 'Italiano', 'српски', 'Hrvatski', '日本語', 'Español', 'Français', '한국어', 'Tagalog', 'Deutsch', 'فارسی', 'Tiếng Việt'];
	var a = document.doctype ? document.doctype.publicId : document.firstChild.data;
	var d = a.indexOf("XHTML") > 0;
	updateLanguage = function () {
		b("#languages a").empty().append(c[Math.floor(Math.random() * c.length)] + " (Other languages)");
		if (d) {
			b("#languages span").attr("xml:lang", b("#languages span").attr("lang"))
	window.setInterval(updateLanguage, 5000)


  • Other languages
  • Sponsors