Add kick-off code for client-side l10n
parent
edacb3e2ca
commit
25be9b8c93
|
@ -805,6 +805,14 @@ window.html10n = (function(window, document, undefined) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the language that was last applied to the translations hash
|
||||||
|
* thus overriding most of the formerly applied langs
|
||||||
|
*/
|
||||||
|
html10n.getLanguage = function() {
|
||||||
|
this.language
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index all <link>s
|
* Index all <link>s
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
(function(document) {
|
||||||
|
// Set language for l10n
|
||||||
|
var language = document.cookie.match(/language=(\w{2})/);
|
||||||
|
if(language) language = language[1];
|
||||||
|
|
||||||
|
html10n.bind('indexed', function() {
|
||||||
|
html10n.localize([language, navigator.language, navigator.userLanguage, 'en'])
|
||||||
|
})
|
||||||
|
|
||||||
|
html10n.bind('localized', function() {
|
||||||
|
document.documentElement.lang = html10n.getLanguage()
|
||||||
|
})
|
||||||
|
})(document)
|
Loading…
Reference in New Issue