mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-08 03:02:03 +01:00
Fix html10n and the locale resource <link>s
This commit is contained in:
parent
2b860986e8
commit
67c893aaca
4 changed files with 15 additions and 9 deletions
|
@ -54,9 +54,9 @@ window.html10n = (function(window, document, undefined) {
|
||||||
*/
|
*/
|
||||||
MicroEvent.mixin = function(destObject){
|
MicroEvent.mixin = function(destObject){
|
||||||
var props = ['bind', 'unbind', 'trigger'];
|
var props = ['bind', 'unbind', 'trigger'];
|
||||||
if(!destObject.prototype) destObject.prototype = {};
|
if(!destObject) return;
|
||||||
for(var i = 0; i < props.length; i ++){
|
for(var i = 0; i < props.length; i ++){
|
||||||
destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
|
destObject[props[i]] = MicroEvent.prototype[props[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ window.html10n = (function(window, document, undefined) {
|
||||||
* The html10n object
|
* The html10n object
|
||||||
*/
|
*/
|
||||||
var html10n =
|
var html10n =
|
||||||
{ language: null
|
{ language : null
|
||||||
}
|
}
|
||||||
MicroEvent.mixin(html10n)
|
MicroEvent.mixin(html10n)
|
||||||
|
|
||||||
|
@ -819,6 +819,7 @@ window.html10n = (function(window, document, undefined) {
|
||||||
html10n.index = function () {
|
html10n.index = function () {
|
||||||
// Find all <link>s
|
// Find all <link>s
|
||||||
var links = document.getElementsByTagName('link')
|
var links = document.getElementsByTagName('link')
|
||||||
|
, resources = []
|
||||||
for (var i=0, n=links.length; i < n; i++) {
|
for (var i=0, n=links.length; i < n; i++) {
|
||||||
if (links[i].type != 'application/l10n+json')
|
if (links[i].type != 'application/l10n+json')
|
||||||
continue;
|
continue;
|
||||||
|
@ -829,12 +830,17 @@ window.html10n = (function(window, document, undefined) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.addEventListener) // modern browsers and IE9+
|
if (document.addEventListener) // modern browsers and IE9+
|
||||||
document.addEventListener('DOMContentLoaded', html10n.index, false)
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
html10n.index()
|
||||||
|
}, false)
|
||||||
else if (window.attachEvent)
|
else if (window.attachEvent)
|
||||||
document.attachEvent('onload', html10n.index, false)
|
document.attachEvent('onload', function() {
|
||||||
|
html10n.index()
|
||||||
|
}, false)
|
||||||
|
|
||||||
// gettext-like shortcut
|
// gettext-like shortcut
|
||||||
if (window._ === undefined)
|
if (window._ === undefined)
|
||||||
var _ = html10n.get;
|
var _ = html10n.get;
|
||||||
|
|
||||||
|
return html10n
|
||||||
})(window, document)
|
})(window, document)
|
|
@ -33,7 +33,7 @@
|
||||||
<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">
|
||||||
<link rel="shortcut icon" href="<%=settings.favicon%>">
|
<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/html10n.js"></script>
|
||||||
<script type="text/javascript" src="../static/js/l10n.js"></script>
|
<script type="text/javascript" src="../static/js/l10n.js"></script>
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<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">
|
||||||
<link rel="shortcut icon" href="<%=settings.faviconPad%>">
|
<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/html10n.js"></script>
|
||||||
<script type="text/javascript" src="../static/js/l10n.js"></script>
|
<script type="text/javascript" src="../static/js/l10n.js"></script>
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<link rel="shortcut icon" href="<%=settings.faviconTimeslider%>">
|
<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/html10n.js"></script>
|
||||||
<script type="text/javascript" src="../../static/js/l10n.js"></script>
|
<script type="text/javascript" src="../../static/js/l10n.js"></script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue