diff --git a/docs/index.html b/docs/index.html index 25e27a00bb7d681b213e7dfea351c58a7c32b51f..4445a22dae55948e7433ef9ddb786b5e37ac6791 100644 --- a/docs/index.html +++ b/docs/index.html @@ -41,18 +41,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;