diff --git a/docs/index.html b/docs/index.html index 6b93c3e0cbb2c2aa06fcc16a2b9d87e8c78e52b8..777e65503c5a1bb1fac1b37c7c9cb562d888daf9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -54,18 +54,30 @@ var hash = window.location.hash.substring( 1 ); - // Route non-localised api links + // Localisation - if ( /^(api|manual)/.test( hash ) && /^(api|manual)\/(en|zh)\//.test( hash ) === false ) { + var language = 'en'; + + if ( /^(api|manual)/.test( hash ) ) { + + var hashLanguage = /^(api|manual)\/(en|zh)\//.exec( hash ); + + if ( hashLanguage === null ) { + + // Route old non-localised api links + + window.location.hash = hash.replace( /^(api|manual)/, '$1/en' ); - window.location.hash = hash.replace( /^(api|manual)/, '$1/en' ); + } else { + + language = hashLanguage[ 2 ]; + + } } // - var language = 'en'; - function setLanguage( value ) { language = value;