From d8d11e39767e74e80e9c81474d255c84bdd2b913 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 16 Dec 2013 15:59:44 +0100 Subject: Fixed JS plural function to be per app Some apps might not define the same "nplural" value. To avoid conflicts, the plural function is now generated per app. Fixes #6427 --- core/js/js.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 5442039c294..7a6bfd63cc7 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -48,8 +48,8 @@ function initL10N(app) { t.cache[app] = []; } } - if (typeof t.plural_function == 'undefined') { - t.plural_function = function (n) { + if (typeof t.plural_function[app] == 'undefined') { + t.plural_function[app] = function (n) { var p = (n != 1) ? 1 : 0; return { 'nplural' : 2, 'plural' : p }; }; @@ -74,7 +74,7 @@ function initL10N(app) { Gettext._locale_data[domain].head.plural_func = eval("("+code+")"); */ var code = 'var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) };'; - t.plural_function = new Function("n", code); + t.plural_function[app] = new Function("n", code); } else { console.log("Syntax error in language file. Plural-Forms header is invalid ["+t.plural_forms+"]"); } @@ -110,6 +110,10 @@ function t(app, text, vars, count){ } } t.cache = {}; +// different apps might or might not redefine the nplurals function correctly +// this is to make sure that a "broken" app doesn't mess up with the +// other app's plural function +t.plural_function = {}; /** * translate a string @@ -126,7 +130,7 @@ function n(app, text_singular, text_plural, count, vars) { if( typeof( t.cache[app][identifier] ) !== 'undefined' ){ var translation = t.cache[app][identifier]; if ($.isArray(translation)) { - var plural = t.plural_function(count); + var plural = t.plural_function[app](count); return t(app, translation[plural.plural], vars, count); } } -- cgit v1.2.3 From 3e17fbe30dbf2a0e99c7aca83d855fb8df46d11b Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 13 Dec 2013 14:34:26 +0100 Subject: always show home breadcrumb in files view --- apps/files/templates/part.breadcrumb.php | 12 +++++------- core/js/js.js | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'core/js/js.js') diff --git a/apps/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php index 9db27eb9b29..90d07d4336c 100644 --- a/apps/files/templates/part.breadcrumb.php +++ b/apps/files/templates/part.breadcrumb.php @@ -1,10 +1,8 @@ - -
- - - -
- +
" data-dir=''> + + + +
diff --git a/core/js/js.js b/core/js/js.js index d9b3b54e0a1..66faa48f85f 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -471,11 +471,11 @@ OC.Breadcrumb={ }, _show:function(container, dir, leafname, leaflink){ var self = this; - + this._clear(container); - + // show home + path in subdirectories - if (dir && dir !== '/') { + if (dir) { //add home var link = OC.linkTo('files','index.php'); @@ -502,7 +502,7 @@ OC.Breadcrumb={ } }); } - + //add leafname if (leafname && leaflink) { this._push(container, leafname, leaflink); -- cgit v1.2.3