From 6ef41bdf1c86c5c8ee333c79a818de7810535197 Mon Sep 17 00:00:00 2001 From: frost768 Date: Sun, 23 Apr 2023 20:01:12 +0300 Subject: [PATCH 1/2] language based time formatting --- src/setup/locales/en/translation.json | 2 +- src/setup/locales/fr/translation.json | 2 +- src/setup/locales/nl/translation.json | 2 +- src/video/components/actions/TimeAction.tsx | 9 ++++----- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/setup/locales/en/translation.json b/src/setup/locales/en/translation.json index fba37d84..d8b81da4 100644 --- a/src/setup/locales/en/translation.json +++ b/src/setup/locales/en/translation.json @@ -58,7 +58,7 @@ "backToHomeShort": "Back", "seasonAndEpisode": "S{{season}} E{{episode}}", "timeLeft": "{{timeLeft}} left", - "finishAt": "Finish at {{timeFinished}}", + "finishAt": "Finish at {{timeFinished, datetime}}", "buttons": { "episodes": "Episodes", "source": "Source", diff --git a/src/setup/locales/fr/translation.json b/src/setup/locales/fr/translation.json index fe9d73eb..505aa046 100644 --- a/src/setup/locales/fr/translation.json +++ b/src/setup/locales/fr/translation.json @@ -40,7 +40,7 @@ "backToHomeShort": "Retour", "seasonAndEpisode": "S{{season}} E{{episode}}", "timeLeft": "{{timeLeft}} restant", - "finishAt": "Terminer à {{timeFinished}}", + "finishAt": "Terminer à {{timeFinished, datetime}}", "buttons": { "episodes": "Épisodes", "source": "Source", diff --git a/src/setup/locales/nl/translation.json b/src/setup/locales/nl/translation.json index 94e796e8..23ecb618 100644 --- a/src/setup/locales/nl/translation.json +++ b/src/setup/locales/nl/translation.json @@ -58,7 +58,7 @@ "backToHomeShort": "Terug", "seasonAndEpisode": "S{{season}} A{{episode}}", "timeLeft": "Nog {{timeLeft}}", - "finishAt": "Afgelopen om {{timeFinished}}", + "finishAt": "Afgelopen om {{timeFinished, datetime}}", "buttons": { "episodes": "Afleveringen", "source": "Bron", diff --git a/src/video/components/actions/TimeAction.tsx b/src/video/components/actions/TimeAction.tsx index bab9e101..5767e039 100644 --- a/src/video/components/actions/TimeAction.tsx +++ b/src/video/components/actions/TimeAction.tsx @@ -61,13 +61,12 @@ export function TimeAction(props: Props) { const timeFinished = new Date( new Date().getTime() + (videoTime.duration * 1000) / mediaPlaying.playbackSpeed - ).toLocaleTimeString("en-US", { - hour: "numeric", - minute: "numeric", - hour12: true, - }); + ); const formattedTimeFinished = ` - ${t("videoPlayer.finishAt", { timeFinished, + formatParams: { + timeFinished: { hour: "numeric", minute: "numeric" }, + }, })}`; let formattedTime: string; From f03145ee6df03d0b532ebbded0843f9d92877fda Mon Sep 17 00:00:00 2001 From: frost768 Date: Sat, 6 May 2023 15:03:13 +0300 Subject: [PATCH 2/2] formatting added to new translation files --- src/setup/locales/cs/translation.json | 2 +- src/setup/locales/de/translation.json | 2 +- src/setup/locales/zh/translation.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/setup/locales/cs/translation.json b/src/setup/locales/cs/translation.json index 3679611a..a7e5e826 100644 --- a/src/setup/locales/cs/translation.json +++ b/src/setup/locales/cs/translation.json @@ -58,7 +58,7 @@ "backToHomeShort": "Zpět", "seasonAndEpisode": "S{{season}} E{{episode}}", "timeLeft": "Zbývá {{timeLeft}}", - "finishAt": "Končí ve {{timeFinished}}", + "finishAt": "Končí ve {{timeFinished, datetime}}", "buttons": { "episodes": "Epizody", "source": "Zdroj", diff --git a/src/setup/locales/de/translation.json b/src/setup/locales/de/translation.json index 82d2fe64..5edad4d0 100644 --- a/src/setup/locales/de/translation.json +++ b/src/setup/locales/de/translation.json @@ -58,7 +58,7 @@ "backToHomeShort": "Rückmeldung", "seasonAndEpisode": "S{{season}} E{{episode}}", "timeLeft": "{{timeLeft}} bleibt", - "finishAt": "Ende um {{timeFinished}}", + "finishAt": "Ende um {{timeFinished, datetime}}", "buttons": { "episodes": "Folgen", "source": "Quelle", diff --git a/src/setup/locales/zh/translation.json b/src/setup/locales/zh/translation.json index 6570d4a4..39b0998d 100644 --- a/src/setup/locales/zh/translation.json +++ b/src/setup/locales/zh/translation.json @@ -58,7 +58,7 @@ "backToHomeShort": "返回", "seasonAndEpisode": "第{{season}}季 第{{episode}}集", "timeLeft": "还剩余 {{timeLeft}}", - "finishAt": "在 {{timeFinished}} 结束", + "finishAt": "在 {{timeFinished, datetime}} 结束", "buttons": { "episodes": "分集", "source": "视频源",