|
@@ -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;
|