diff options
author | Jakob Sack <mail@jakobsack.de> | 2013-07-16 22:16:53 +0200 |
---|---|---|
committer | Jakob Sack <mail@jakobsack.de> | 2013-07-16 22:16:53 +0200 |
commit | bb0c5bff5fc493dd24c2c9cbbf27986fd5098de1 (patch) | |
tree | 9aa2eceb270a6f9fbeaba5ec74b3a37f0121a5cc /core | |
parent | 18fc22b52bdf1d8372a6e9c602872c423ce50eff (diff) | |
download | nextcloud-server-bb0c5bff5fc493dd24c2c9cbbf27986fd5098de1.tar.gz nextcloud-server-bb0c5bff5fc493dd24c2c9cbbf27986fd5098de1.zip |
Add multiple plural forms to the php part
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/js/js.js b/core/js/js.js index 15cf1d286fa..37540bd15e7 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -33,7 +33,7 @@ if (oc_debug !== true || typeof console === "undefined" || typeof console.log == * @return string */ function t(app, text, vars, count){ - if( !( t.cache[app] )){ + if( !( t.cache[app] )) { $.ajax(OC.filePath('core','ajax','translations.php'),{ async:false,//todo a proper sollution for this without sync ajax calls data:{'app': app}, @@ -49,8 +49,7 @@ function t(app, text, vars, count){ } } var _build = function (text, vars, count) { - // FIXME: replace %n with content of count - return text.replace(/{([^{}]*)}/g, + return text.replace(/%n/g, count).replace(/{([^{}]*)}/g, function (a, b) { var r = vars[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; @@ -62,7 +61,7 @@ function t(app, text, vars, count){ translation = t.cache[app][text]; } - if(typeof vars === 'object' || typeof count !== 'undefined' ) { + if(typeof vars === 'object' || count !== undefined ) { return _build(translation, vars, count); } else { return translation; @@ -79,8 +78,8 @@ t.cache={}; * @param vars (optional) FIXME * @return string */ -function tp(app, text_singular, text_plural, count, vars){ - if(count==1){ +function n(app, text_singular, text_plural, count, vars){ + if(count === 1) { return t(app, text_singular, vars, count); } else{ |