diff options
author | John McLear <john@mclear.co.uk> | 2012-11-17 07:31:21 -0800 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2012-11-17 07:31:21 -0800 |
commit | d6c0f9608403a6ba0f330d12da0fb68e65d66cd6 (patch) | |
tree | b373eb123e3f9f4cf8a62137d46565fcc24c3418 /src | |
parent | 73eafb92c27c57a5936ec241a228657e16aa06b7 (diff) | |
parent | 5baef07b559bbc6d6cd1410ffd0c8f9e987ef575 (diff) | |
download | etherpad-lite-d6c0f9608403a6ba0f330d12da0fb68e65d66cd6.zip |
Merge pull request #1177 from marcelklehr/fix/optimize-l10n-loading-times
optimize l10n loading times
Diffstat (limited to 'src')
-rw-r--r-- | src/locales/en.ini | 2 | ||||
-rw-r--r-- | src/node/hooks/i18n.js | 4 | ||||
-rw-r--r-- | src/templates/index.html | 16 | ||||
-rw-r--r-- | src/templates/pad.html | 17 | ||||
-rw-r--r-- | src/templates/timeslider.html | 19 |
5 files changed, 31 insertions, 27 deletions
diff --git a/src/locales/en.ini b/src/locales/en.ini index 95b8eadd..6077c1f5 100644 --- a/src/locales/en.ini +++ b/src/locales/en.ini @@ -1,4 +1,4 @@ -[en] +[*] index.newPad = New Pad index.createOpenPad = or create/open a Pad with the name: pad.toolbar.bold.title = Bold (Ctrl-B) diff --git a/src/node/hooks/i18n.js b/src/node/hooks/i18n.js index 6238f2cb..50946c42 100644 --- a/src/node/hooks/i18n.js +++ b/src/node/hooks/i18n.js @@ -5,7 +5,9 @@ var Globalize = require('globalize') var localesPath = __dirname+"/../../locales"; -var localeIndex = '[*]\r\n@import url(locales/en.ini)\r\n'; +// Serve English strings directly with /locales.ini +var localeIndex = fs.readFileSync(localesPath+'/en.ini')+'\r\n'; + exports.availableLangs = {en: 'English'}; fs.readdir(localesPath, function(er, files) { diff --git a/src/templates/index.html b/src/templates/index.html index c1214007..9fd33a26 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -33,6 +33,15 @@ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> <link rel="resource" type="application/l10n" href="locales.ini" /> <link rel="shortcut icon" href="<%=settings.favicon%>"> + + <script type="text/javascript"> + (function(document) { + // Set language for l10n + var language = document.cookie.match(/language=(\w{2})/); + if(language) document.documentElement.lang = language[1]; + })(document) + </script> + <script type="text/javascript" src="static/js/l10n.js" async></script> <style> html, body { @@ -184,14 +193,7 @@ return randomstring; } - (function(document) { - // Set language for l10n - var language = document.cookie.match(/language=(\w{2})/); - 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> diff --git a/src/templates/pad.html b/src/templates/pad.html index 35f0b5de..82bd1070 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -32,11 +32,17 @@ <meta charset="utf-8"> <meta name="robots" content="noindex, nofollow"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> + <link rel="shortcut icon" href="<%=settings.favicon%>"> <link rel="resource" type="application/l10n" href="../locales.ini" /> - - - <link rel="shortcut icon" href="<%=settings.favicon%>"> + <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" async></script> <% e.begin_block("styles"); %> <link href="../static/css/pad.css" rel="stylesheet"> @@ -381,14 +387,9 @@ // 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> diff --git a/src/templates/timeslider.html b/src/templates/timeslider.html index ca5f2789..dfeee16c 100644 --- a/src/templates/timeslider.html +++ b/src/templates/timeslider.html @@ -32,8 +32,16 @@ <meta charset="utf-8"> <meta name="robots" content="noindex, nofollow"> <link rel="shortcut icon" href="<%=settings.favicon%>"> - <script type="text/javascript" src="../../static/js/l10n.js"></script> <link rel="resource" type="application/l10n" href="../../locales.ini" /> + + <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" async></script> <link rel="stylesheet" href="../../static/css/pad.css"> <link rel="stylesheet" href="../../static/css/timeslider.css"> <link rel="stylesheet" href="../../static/custom/timeslider.css"> @@ -169,15 +177,6 @@ </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> |