import { locales } from '@pisell/utils';

/** 带 i18n 的时长展示 */
export var formatDurationI18n = function formatDurationI18n(minutes) {
  var total = Math.max(0, Math.ceil(minutes));
  var days = Math.floor(total / 1440);
  var hours = Math.floor(total % 1440 / 60);
  var mins = total % 60;
  var parts = [];
  if (days) {
    parts.push("".concat(days, " ").concat(locales.getText(days === 1 ? 'pisell2.adjust-time.day-one' : 'pisell2.adjust-time.day-other')));
  }
  if (hours) {
    parts.push("".concat(hours, " ").concat(locales.getText(hours === 1 ? 'pisell2.adjust-time.hour-one' : 'pisell2.adjust-time.hour-other')));
  }
  if (mins || !parts.length) {
    parts.push("".concat(mins, " ").concat(locales.getText(mins === 1 ? 'pisell2.adjust-time.minute-one' : 'pisell2.adjust-time.minute-other')));
  }
  return parts.join(' ');
};
export var t = function t(key) {
  return locales.getText(key);
};