Browse Source

language based time formatting

pull/274/head
frost768 3 years ago
parent
commit
6ef41bdf1c
  1. 2
      src/setup/locales/en/translation.json
  2. 2
      src/setup/locales/fr/translation.json
  3. 2
      src/setup/locales/nl/translation.json
  4. 9
      src/video/components/actions/TimeAction.tsx

2
src/setup/locales/en/translation.json

@ -58,7 +58,7 @@
"backToHomeShort": "Back", "backToHomeShort": "Back",
"seasonAndEpisode": "S{{season}} E{{episode}}", "seasonAndEpisode": "S{{season}} E{{episode}}",
"timeLeft": "{{timeLeft}} left", "timeLeft": "{{timeLeft}} left",
"finishAt": "Finish at {{timeFinished}}", "finishAt": "Finish at {{timeFinished, datetime}}",
"buttons": { "buttons": {
"episodes": "Episodes", "episodes": "Episodes",
"source": "Source", "source": "Source",

2
src/setup/locales/fr/translation.json

@ -40,7 +40,7 @@
"backToHomeShort": "Retour", "backToHomeShort": "Retour",
"seasonAndEpisode": "S{{season}} E{{episode}}", "seasonAndEpisode": "S{{season}} E{{episode}}",
"timeLeft": "{{timeLeft}} restant", "timeLeft": "{{timeLeft}} restant",
"finishAt": "Terminer à {{timeFinished}}", "finishAt": "Terminer à {{timeFinished, datetime}}",
"buttons": { "buttons": {
"episodes": "Épisodes", "episodes": "Épisodes",
"source": "Source", "source": "Source",

2
src/setup/locales/nl/translation.json

@ -58,7 +58,7 @@
"backToHomeShort": "Terug", "backToHomeShort": "Terug",
"seasonAndEpisode": "S{{season}} A{{episode}}", "seasonAndEpisode": "S{{season}} A{{episode}}",
"timeLeft": "Nog {{timeLeft}}", "timeLeft": "Nog {{timeLeft}}",
"finishAt": "Afgelopen om {{timeFinished}}", "finishAt": "Afgelopen om {{timeFinished, datetime}}",
"buttons": { "buttons": {
"episodes": "Afleveringen", "episodes": "Afleveringen",
"source": "Bron", "source": "Bron",

9
src/video/components/actions/TimeAction.tsx

@ -61,13 +61,12 @@ export function TimeAction(props: Props) {
const timeFinished = new Date( const timeFinished = new Date(
new Date().getTime() + new Date().getTime() +
(videoTime.duration * 1000) / mediaPlaying.playbackSpeed (videoTime.duration * 1000) / mediaPlaying.playbackSpeed
).toLocaleTimeString("en-US", { );
hour: "numeric",
minute: "numeric",
hour12: true,
});
const formattedTimeFinished = ` - ${t("videoPlayer.finishAt", { const formattedTimeFinished = ` - ${t("videoPlayer.finishAt", {
timeFinished, timeFinished,
formatParams: {
timeFinished: { hour: "numeric", minute: "numeric" },
},
})}`; })}`;
let formattedTime: string; let formattedTime: string;

Loading…
Cancel
Save