r68667 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68666‎ | r68667 | r68668 >
Date:17:29, 28 June 2010
Author:liangent
Status:ok
Tags:
Comment:
Use some usability initiative feature on prototype wikis to do auto language selection
Modified paths:
  • /trunk/tools/planet/zh/templates/index.html.tmpl (modified) (history)

Diff [purge]

Index: trunk/tools/planet/zh/templates/index.html.tmpl
@@ -18,7 +18,23 @@
1919 <link rel="stylesheet" href="planet.css" type="text/css">
2020 <TMPL_IF feedtype>
2121 <link rel="alternate" href="<TMPL_VAR feed ESCAPE="HTML">" title="<TMPL_VAR channel_title_plain ESCAPE="HTML">" type="application/<TMPL_VAR feedtype>+xml">
22 -</TMPL_IF>
 22+</TMPL_IF>
 23+<script type="text/javascript">
 24+<!--
 25+function acceptlang(o) {
 26+ var al = o.query.userinfo.acceptlang;
 27+ for (var i = 0; i < al.length; i++) {
 28+ var l = al[i].*.replace('_', '-').toLowerCase();
 29+ if ('zh-hans|zh-cn|zh-my|zh-sg'.indexOf(l)) {
 30+ window.location.href = 'index.zh-hans.html';
 31+ } else if ('zh-hant|zh-hk|zh-mo|zh-tw'.indexOf(l)) {
 32+ window.location.href = 'index.zh-hant.html';
 33+ }
 34+ }
 35+}
 36+//-->
 37+</script>
 38+<script src="http://prototype.wikimedia.org/en-wp/api.php?action=query&meta=userinfo&uiprop=acceptlang&format=json&callback=acceptlang"></script>
2339 </head>
2440
2541 <body>

Status & tagging log