mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: use i18n interpolation for minutes and hours
This commit is contained in:
parent
a98a0eadd8
commit
30ed41be61
@ -61,6 +61,8 @@
|
||||
"copied_link_to_clipboard": "Link copiado",
|
||||
"hours": "horas",
|
||||
"minutes": "minutos",
|
||||
"amount_hours": "{{amount}} horas",
|
||||
"amount_minutes": "{{amount}} minutos",
|
||||
"accuracy": "{{accuracy}}% de precisão",
|
||||
"add_to_library": "Adicionar à biblioteca",
|
||||
"remove_from_library": "Remover da biblioteca",
|
||||
|
@ -57,19 +57,24 @@ export function HeroPanel({
|
||||
}
|
||||
}, [game?.lastTimePlayed, formatDistance]);
|
||||
|
||||
const formatPlayTime = (milliseconds: number) => {
|
||||
const seconds = milliseconds / 1000
|
||||
const minutes = seconds / 60
|
||||
const formatPlayTime = () => {
|
||||
const milliseconds = game?.playTimeInMilliseconds || 0;
|
||||
const seconds = milliseconds / 1000;
|
||||
const minutes = seconds / 60;
|
||||
|
||||
if (minutes < 120) {
|
||||
return minutes.toFixed(0) + " " + t("minutes")
|
||||
}
|
||||
if (minutes < 120) {
|
||||
return t("amount_minutes", {
|
||||
amount: minutes.toFixed(0),
|
||||
});
|
||||
}
|
||||
|
||||
const numberFormat = new Intl.NumberFormat(i18n.language, { maximumFractionDigits: 1 })
|
||||
const numberFormat = new Intl.NumberFormat(i18n.language, {
|
||||
maximumFractionDigits: 1,
|
||||
});
|
||||
|
||||
const hours = minutes / 60
|
||||
return numberFormat.format(hours) + " " + t("hours")
|
||||
}
|
||||
const hours = minutes / 60;
|
||||
return t("amount_hours", { amount: numberFormat.format(hours) });
|
||||
};
|
||||
|
||||
const finalDownloadSize = useMemo(() => {
|
||||
if (!game) return "N/A";
|
||||
|
Loading…
Reference in New Issue
Block a user