Skip to content

Commit

Permalink
Use gettextCatalog.getPlural function
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Mar 29, 2018
1 parent 655a44d commit bfc751a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/misc/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ ngeo.misc.filters.filter('ngeoTrustHtml', ngeo.misc.filters.trustHtmlFilter);
* -> Note: the remaining 10 seconds will be dropped
*
* @param {angularGettext.Catalog} gettextCatalog Gettext catalog.
* @return {ngeox.duration} Function used to format a time duration
* in seconds into a string.
* @return {ngeox.duration} Function used to format a time duration in seconds into a string.
* @ngInject
* @ngdoc filter
* @ngname ngeoDuration
Expand All @@ -359,16 +358,16 @@ ngeo.misc.filters.Duration = function(gettextCatalog) {
let formattedUnit = '';
switch (unit) {
case TimeUnits.SECONDS:
formattedUnit = amount !== 1 ? gettextCatalog.getString('seconds') : gettextCatalog.getString('second');
formattedUnit = gettextCatalog.getPlural(amount, 'second', 'seconds');
break;
case TimeUnits.MINUTES:
formattedUnit = amount !== 1 ? gettextCatalog.getString('minutes') : gettextCatalog.getString('minute');
formattedUnit = gettextCatalog.getPlural(amount, 'minute', 'minutes');
break;
case TimeUnits.HOURS:
formattedUnit = amount !== 1 ? gettextCatalog.getString('hours') : gettextCatalog.getString('hour');
formattedUnit = gettextCatalog.getPlural(amount, 'hour', 'hours');
break;
case TimeUnits.DAYS:
formattedUnit = amount !== 1 ? gettextCatalog.getString('days') : gettextCatalog.getString('day');
formattedUnit = gettextCatalog.getPlural(amount, 'day', 'days');
break;
default:
break;
Expand Down

0 comments on commit bfc751a

Please sign in to comment.