Merge pull request #1159 from marcelklehr/fix/lang-autodetection

Fix language auto-detection
pull/1160/head
John McLear 2012-11-14 10:58:07 -08:00
commit 68b1d78f32
3 changed files with 20 additions and 17 deletions

View File

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

View File

@ -33,7 +33,6 @@
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> <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="resource" type="application/l10n" href="../locales.ini" />
@ -370,10 +369,9 @@
<% e.begin_block("scripts"); %> <% e.begin_block("scripts"); %>
<script type="text/javascript"> <script type="text/javascript">
/* Display errors on page load to the user
(Gets overridden by padutils.setupGlobalExceptionHandler)
*/
(function() { (function() {
// Display errors on page load to the user
// (Gets overridden by padutils.setupGlobalExceptionHandler)
var originalHandler = window.onerror; var originalHandler = window.onerror;
window.onerror = function(msg, url, line) { window.onerror = function(msg, url, line) {
var box = document.getElementById('editorloadingbox'); var box = document.getElementById('editorloadingbox');
@ -383,9 +381,14 @@
// call original error handler // call original error handler
if(typeof(originalHandler) == 'function') originalHandler.call(null, arguments); 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>
<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="../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../socket.io/socket.io.js"></script> <script type="text/javascript" src="../socket.io/socket.io.js"></script>
@ -399,10 +402,6 @@
<script type="text/javascript"> <script type="text/javascript">
var clientVars = {}; var clientVars = {};
(function () { (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('/'); var pathComponents = location.pathname.split('/');
// Strip 'p' and the padname from the pathname and set as baseURL // 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 , langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
%> %>
<!doctype html> <!doctype html>
<html lang="en"> <html>
<title data-l10n-id="timeslider.pageTitle" data-l10n-args='{ "appTitle": "<%=settings.title%>" }'><%=settings.title%> Timeslider</title> <title data-l10n-id="timeslider.pageTitle" data-l10n-args='{ "appTitle": "<%=settings.title%>" }'><%=settings.title%> Timeslider</title>
<script> <script>
/* /*
@ -169,6 +169,15 @@
</div> </div>
</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="../../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script> <script type="text/javascript" src="../../socket.io/socket.io.js"></script>
@ -183,10 +192,6 @@
var clientVars = {}; var clientVars = {};
(function () { (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('/'); var pathComponents = location.pathname.split('/');
// Strip 'p', the padname and 'timeslider' from the pathname and set as baseURL // Strip 'p', the padname and 'timeslider' from the pathname and set as baseURL