http://www.mediawiki.org/wiki/Special:Code/MediaWiki/68669

Revision: 68669
Author:   liangent
Date:     2010-06-28 17:46:24 +0000 (Mon, 28 Jun 2010)

Log Message:
-----------
Fixes of the auto language selection

Modified Paths:
--------------
    trunk/tools/planet/zh/templates/index.html.tmpl

Modified: trunk/tools/planet/zh/templates/index.html.tmpl
===================================================================
--- trunk/tools/planet/zh/templates/index.html.tmpl     2010-06-28 17:41:03 UTC 
(rev 68668)
+++ trunk/tools/planet/zh/templates/index.html.tmpl     2010-06-28 17:46:24 UTC 
(rev 68669)
@@ -25,10 +25,12 @@
     var al = o.query.userinfo.acceptlang;
     for (var i = 0; i < al.length; i++) {
         var l = al[i].*.replace('_', '-').toLowerCase();
-        if ('zh-hans|zh-cn|zh-my|zh-sg'.indexOf(l)) {
+        if ('zh-hans|zh-cn|zh-my|zh-sg'.indexOf(l) != -1) {
             window.location.href = 'index.zh-hans.html';
-        } else if ('zh-hant|zh-hk|zh-mo|zh-tw'.indexOf(l)) {
+            break;
+        } else if ('zh-hant|zh-hk|zh-mo|zh-tw'.indexOf(l) != -1) {
             window.location.href = 'index.zh-hant.html';
+            break;
         }
     }
 }



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to