diff options
author | Marcel Klehr <mklehr@gmx.net> | 2012-12-17 18:18:20 +0100 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2012-12-23 18:16:39 +0100 |
commit | 67c893aacaca26d835505c911ec465e35cf88d0d (patch) | |
tree | 6597f7fd5904a874c8131cb7784058defd7154f2 | |
parent | 2b860986e8218f8178c8531fe6b268d3bc2b5d0a (diff) | |
download | etherpad-lite-67c893aacaca26d835505c911ec465e35cf88d0d.zip |
Fix html10n and the locale resource <link>s
-rw-r--r-- | src/static/js/html10n.js | 18 | ||||
-rw-r--r-- | src/templates/index.html | 2 | ||||
-rw-r--r-- | src/templates/pad.html | 2 | ||||
-rw-r--r-- | src/templates/timeslider.html | 2 |
4 files changed, 15 insertions, 9 deletions
diff --git a/src/static/js/html10n.js b/src/static/js/html10n.js index 9c85cd2f..3c2e2072 100644 --- a/src/static/js/html10n.js +++ b/src/static/js/html10n.js @@ -54,9 +54,9 @@ window.html10n = (function(window, document, undefined) { */ MicroEvent.mixin = function(destObject){ var props = ['bind', 'unbind', 'trigger']; - if(!destObject.prototype) destObject.prototype = {}; + if(!destObject) return; for(var i = 0; i < props.length; i ++){ - destObject.prototype[props[i]] = MicroEvent.prototype[props[i]]; + destObject[props[i]] = MicroEvent.prototype[props[i]]; } } @@ -148,8 +148,8 @@ window.html10n = (function(window, document, undefined) { /** * The html10n object */ - var html10n = - { language: null + var html10n = + { language : null } MicroEvent.mixin(html10n) @@ -819,6 +819,7 @@ window.html10n = (function(window, document, undefined) { html10n.index = function () { // Find all <link>s var links = document.getElementsByTagName('link') + , resources = [] for (var i=0, n=links.length; i < n; i++) { if (links[i].type != 'application/l10n+json') continue; @@ -829,12 +830,17 @@ window.html10n = (function(window, document, undefined) { } if (document.addEventListener) // modern browsers and IE9+ - document.addEventListener('DOMContentLoaded', html10n.index, false) + document.addEventListener('DOMContentLoaded', function() { + html10n.index() + }, false) else if (window.attachEvent) - document.attachEvent('onload', html10n.index, false) + document.attachEvent('onload', function() { + html10n.index() + }, false) // gettext-like shortcut if (window._ === undefined) var _ = html10n.get; + return html10n })(window, document)
\ No newline at end of file diff --git a/src/templates/index.html b/src/templates/index.html index 222b9f29..668b7abe 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -33,7 +33,7 @@ <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="localizations" type="application/l10n+json" href="../locales.ini" /> + <link rel="localizations" type="application/l10n+json" href="../locales.json" /> <script type="text/javascript" src="../static/js/html10n.js"></script> <script type="text/javascript" src="../static/js/l10n.js"></script> diff --git a/src/templates/pad.html b/src/templates/pad.html index caeb4553..db04f8b8 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -34,7 +34,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> <link rel="shortcut icon" href="<%=settings.faviconPad%>"> - <link rel="localizations" type="application/l10n+json" href="../locales.ini" /> + <link rel="localizations" type="application/l10n+json" href="../locales.json" /> <script type="text/javascript" src="../static/js/html10n.js"></script> <script type="text/javascript" src="../static/js/l10n.js"></script> diff --git a/src/templates/timeslider.html b/src/templates/timeslider.html index 6f64ae82..26055f9f 100644 --- a/src/templates/timeslider.html +++ b/src/templates/timeslider.html @@ -33,7 +33,7 @@ <meta name="robots" content="noindex, nofollow"> <link rel="shortcut icon" href="<%=settings.faviconTimeslider%>"> - <link rel="localizations" type="application/l10n+json" href="../../locales.ini" /> + <link rel="localizations" type="application/l10n+json" href="../../locales.json" /> <script type="text/javascript" src="../../static/js/html10n.js"></script> <script type="text/javascript" src="../../static/js/l10n.js"></script> |