Use correct plural implementation for upload estimation

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-01-25 10:21:00 +01:00
parent 026ceab35f
commit 1ae01c5eb5
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 6 additions and 9 deletions

View File

@ -1033,11 +1033,10 @@ OC.Uploader.prototype = _.extend({
var timeStringDesktop = ""; var timeStringDesktop = "";
var timeStringMobile = ""; var timeStringMobile = "";
if(date.getUTCHours() > 0){ if(date.getUTCHours() > 0){
timeStringDesktop = t('files', '{hours}:{minutes}:{seconds} hour{plural_s} left' , { timeStringDesktop = n('files', '{hours}:{minutes}:{seconds} hour left', '{hours}:{minutes}:{seconds} hours left', date.getUTCHours(), {
hours:date.getUTCHours(), hours:date.getUTCHours(),
minutes: ('0' + date.getUTCMinutes()).slice(-2), minutes: ('0' + date.getUTCMinutes()).slice(-2),
seconds: ('0' + date.getUTCSeconds()).slice(-2), seconds: ('0' + date.getUTCSeconds()).slice(-2)
plural_s: ( smoothRemainingSeconds === 3600 ? "": "s") // 1 hour = 1*60m*60s = 3600s
}); });
timeStringMobile = t('files', '{hours}:{minutes}h' , { timeStringMobile = t('files', '{hours}:{minutes}h' , {
hours:date.getUTCHours(), hours:date.getUTCHours(),
@ -1045,19 +1044,17 @@ OC.Uploader.prototype = _.extend({
seconds: ('0' + date.getUTCSeconds()).slice(-2) seconds: ('0' + date.getUTCSeconds()).slice(-2)
}); });
} else if(date.getUTCMinutes() > 0){ } else if(date.getUTCMinutes() > 0){
timeStringDesktop = t('files', '{minutes}:{seconds} minute{plural_s} left' , { timeStringDesktop = n('files', '{minutes}:{seconds} minute left', '{minutes}:{seconds} minutes left', date.getUTCMinutes(), {
minutes: date.getUTCMinutes(), minutes: date.getUTCMinutes(),
seconds: ('0' + date.getUTCSeconds()).slice(-2), seconds: ('0' + date.getUTCSeconds()).slice(-2)
plural_s: (smoothRemainingSeconds === 60 ? "": "s") // 1 minute = 1*60s = 60s
}); });
timeStringMobile = t('files', '{minutes}:{seconds}m' , { timeStringMobile = t('files', '{minutes}:{seconds}m' , {
minutes: date.getUTCMinutes(), minutes: date.getUTCMinutes(),
seconds: ('0' + date.getUTCSeconds()).slice(-2) seconds: ('0' + date.getUTCSeconds()).slice(-2)
}); });
} else if(date.getUTCSeconds() > 0){ } else if(date.getUTCSeconds() > 0){
timeStringDesktop = t('files', '{seconds} second{plural_s} left' , { timeStringDesktop = n('files', '{seconds} second left', '{seconds} seconds left', date.getUTCSeconds(), {
seconds: date.getUTCSeconds(), seconds: date.getUTCSeconds()
plural_s: (smoothRemainingSeconds === 1 ? "": "s") // 1 second = 1s = 1s
}); });
timeStringMobile = t('files', '{seconds}s' , {seconds: date.getUTCSeconds()}); timeStringMobile = t('files', '{seconds}s' , {seconds: date.getUTCSeconds()});
} else { } else {