Fix language auto-detection

pull/1159/head
Marcel Klehr 2012-11-14 19:38:35 +01:00
parent 6426b05c67
commit b416402f10
3 changed files with 20 additions and 17 deletions

View File

@ -31,7 +31,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<script type="text/javascript" src="static/js/l10n.js"></script>
<link rel="resource" type="application/l10n" href="locales.ini" />
<link rel="shortcut icon" href="<%=settings.favicon%>">
@ -188,11 +187,11 @@
(function(document) {
// Set language for l10n
var language = document.cookie.match(/language=(\w{2})/);
document.documentElement.lang = language? language[1] : 'en';
if(language) document.documentElement.lang = language[1];
})(document)
// start the custom js
if (typeof customStart == "function") customStart();
</script>
<script type="text/javascript" src="static/js/l10n.js"></script>
</html>

View File

@ -33,7 +33,6 @@
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<script type="text/javascript" src="../static/js/l10n.js"></script>
<link rel="resource" type="application/l10n" href="../locales.ini" />
@ -370,10 +369,9 @@
<% e.begin_block("scripts"); %>
<script type="text/javascript">
/* Display errors on page load to the user
(Gets overridden by padutils.setupGlobalExceptionHandler)
*/
(function() {
// Display errors on page load to the user
// (Gets overridden by padutils.setupGlobalExceptionHandler)
var originalHandler = window.onerror;
window.onerror = function(msg, url, line) {
var box = document.getElementById('editorloadingbox');
@ -383,9 +381,14 @@
// call original error handler
if(typeof(originalHandler) == 'function') originalHandler.call(null, arguments);
};
// Set language for l10n
var language = document.cookie.match(/language=(\w{2})/);
if(language) document.documentElement.lang = language[1];
})();
</script>
<script type="text/javascript" src="../static/js/l10n.js"></script>
<script type="text/javascript" src="../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../socket.io/socket.io.js"></script>
@ -399,10 +402,6 @@
<script type="text/javascript">
var clientVars = {};
(function () {
// Set language for l10n
var language = document.cookie.match(/language=(\w{2})/);
document.documentElement.lang = language? language[1] : 'en';
var pathComponents = location.pathname.split('/');
// Strip 'p' and the padname from the pathname and set as baseURL

View File

@ -3,7 +3,7 @@
, langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
%>
<!doctype html>
<html lang="en">
<html>
<title data-l10n-id="timeslider.pageTitle" data-l10n-args='{ "appTitle": "<%=settings.title%>" }'><%=settings.title%> Timeslider</title>
<script>
/*
@ -170,6 +170,15 @@
</div>
</div>
<script type="text/javascript">
(function() {
// Set language for l10n
var language = document.cookie.match(/language=(\w{2})/);
if(language) document.documentElement.lang = language[1];
})();
</script>
<script type="text/javascript" src="../../static/js/l10n.js"></script>
<script type="text/javascript" src="../../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
@ -184,10 +193,6 @@
var clientVars = {};
(function () {
// Set language for l10n
var language = document.cookie.match(/language=(\w{2})/);
document.documentElement.lang = language? language[1] : 'en';
var pathComponents = location.pathname.split('/');
// Strip 'p', the padname and 'timeslider' from the pathname and set as baseURL