_jade/layouts/example-redirect.jade (13 lines of code) (raw):
block variables
doctype html
html
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
script(type='text/javascript').
var hash = (location.hash || '').replace('#', '');
var search = (location.search || '').replace('?', '');
var lang = navigator.language || navigator.userLanguage;
lang = lang.indexOf('zh') > -1 ? 'zh' : 'en';
location.href = '#{host}/examples/' + lang + '/#{redirectTo}'
+ (search ? '?' + search : '') + (hash ? '#' + hash : '');