mirror of
https://github.com/wassname/talk.git
synced 2026-07-20 12:40:47 +08:00
displaying time in X minutes Y seconds
This commit is contained in:
@@ -35,16 +35,26 @@ export class CountdownSeconds extends React.Component {
|
||||
const {until, classNameForMsRemaining} = this.props;
|
||||
const msRemaining = until - now;
|
||||
const secRemaining = msRemaining / 1000;
|
||||
const wholeSecRemaining = Math.floor(secRemaining);
|
||||
const plural = secRemaining !== 1;
|
||||
const units = t(plural ? 'edit_comment.seconds_plural' : 'edit_comment.second');
|
||||
const minRemaining = secRemaining / 60;
|
||||
const secToMinRemaining = secRemaining % 60;
|
||||
const wholeMinRemaining = Math.floor(minRemaining);
|
||||
const wholeSecRemaining = Math.floor(secToMinRemaining);
|
||||
const secUnit = t(wholeSecRemaining !== 1 ? 'edit_comment.seconds_plural' : 'edit_comment.second');
|
||||
const minUnit = t(wholeMinRemaining !== 1 ? 'edit_comment.minutes_plural' : 'edit_comment.minute');
|
||||
let classFromProp;
|
||||
if (typeof classNameForMsRemaining === 'function') {
|
||||
classFromProp = classNameForMsRemaining(msRemaining);
|
||||
}
|
||||
if (wholeMinRemaining > 0) {
|
||||
return (
|
||||
<span className={classFromProp}>
|
||||
{`${wholeMinRemaining} ${minUnit} ${wholeSecRemaining} ${secUnit}`}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className={classFromProp}>
|
||||
{`${wholeSecRemaining} ${units}`}
|
||||
{`${wholeSecRemaining} ${secUnit}`}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -172,6 +172,8 @@ en:
|
||||
edit_window_timer_prefix: "Edit Window: "
|
||||
second: "second"
|
||||
seconds_plural: "seconds"
|
||||
minute: "minute"
|
||||
minutes_plural: "minutes"
|
||||
email:
|
||||
confirm:
|
||||
has_been_requested: "A email confirmation has been requested for the following account:"
|
||||
|
||||
@@ -171,6 +171,8 @@ es:
|
||||
edit_window_timer_prefix: "Ventana Edición:"
|
||||
second: "segundo"
|
||||
seconds_plural: "segundos"
|
||||
minute: "minuto"
|
||||
minutes_plural: "minutos"
|
||||
email:
|
||||
confirm:
|
||||
has_been_requested: "Un correo de confirmación ha sido pedido para la siguiente cuenta:"
|
||||
|
||||
@@ -140,6 +140,8 @@ fr:
|
||||
edit_window_timer_prefix: "Fenêtre d'édition :"
|
||||
second: "seconde"
|
||||
seconds_plural: "secondes"
|
||||
minute: "minute"
|
||||
minutes_plural: "minutes"
|
||||
unexpected_error: "Erreur inattendue lors de l'enregistrement des modifications. Désolé !"
|
||||
embedlink:
|
||||
copy: "Copier dans le presse-papier"
|
||||
|
||||
@@ -163,6 +163,8 @@ pt_BR:
|
||||
edit_window_timer_prefix: "Para editar:"
|
||||
second: "segundo"
|
||||
seconds_plural: "segundos"
|
||||
minute: "minuto"
|
||||
minutes_plural: "minutos"
|
||||
email:
|
||||
confirm:
|
||||
has_been_requested: "Uma confirmação de e-mail foi solicitada para a seguinte conta:"
|
||||
|
||||
Reference in New Issue
Block a user