From b6324f82080388266f49d7cf27c477b1ce561cc6 Mon Sep 17 00:00:00 2001 From: brikim Date: Sun, 29 Dec 2024 08:04:27 -0600 Subject: [PATCH] Added translations for hard coded items added in sessions. Improved music session card. --- public/locales/en-UK/translation.json | 7 +++++-- public/locales/fr-FR/translation.json | 7 +++++-- public/locales/zh-CN/translation.json | 7 +++++-- src/pages/components/sessions/sessions.jsx | 18 ++++++++++-------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/public/locales/en-UK/translation.json b/public/locales/en-UK/translation.json index e7b5bf6..eddda06 100644 --- a/public/locales/en-UK/translation.json +++ b/public/locales/en-UK/translation.json @@ -17,7 +17,9 @@ "LIBRARY_OVERVIEW": "Library Overview" }, "SESSIONS": { - "NO_SESSIONS": "No Active Sessions Found" + "NO_SESSIONS": "No Active Sessions Found", + "DIRECT_PLAY": "Direct Play", + "TRANSCODE": "Transcode" }, "STAT_CARDS": { "MOST_VIEWED_MOVIES": "MOST VIEWED MOVIES", @@ -301,5 +303,6 @@ "LONGITUDE": "Longitude", "TIMEZONE": "Timezone", "POSTCODE": "Postcode", - "X_ROWS_SELECTED": "{ROWS} Rows Selected" + "X_ROWS_SELECTED": "{ROWS} Rows Selected", + "SUBTITLES": "Subtitles" } diff --git a/public/locales/fr-FR/translation.json b/public/locales/fr-FR/translation.json index b93c71d..c2039bc 100644 --- a/public/locales/fr-FR/translation.json +++ b/public/locales/fr-FR/translation.json @@ -17,7 +17,9 @@ "LIBRARY_OVERVIEW": "Vue d'ensemble des médiathèques" }, "SESSIONS": { - "NO_SESSIONS": "Aucune lecture en cours n'a été trouvée" + "NO_SESSIONS": "Aucune lecture en cours n'a été trouvée", + "DIRECT_PLAY": "", + "TRANSCODE": "" }, "STAT_CARDS": { "MOST_VIEWED_MOVIES": "FILMS LES PLUS VUS", @@ -301,5 +303,6 @@ "LONGITUDE": "Longitude", "TIMEZONE": "Fuseau horaire", "POSTCODE": "Code postal", - "X_ROWS_SELECTED": "{ROWS} Ligne(s) sélectionnée(s)" + "X_ROWS_SELECTED": "{ROWS} Ligne(s) sélectionnée(s)", + "SUBTITLES": "" } diff --git a/public/locales/zh-CN/translation.json b/public/locales/zh-CN/translation.json index cb1f548..a16763b 100644 --- a/public/locales/zh-CN/translation.json +++ b/public/locales/zh-CN/translation.json @@ -17,7 +17,9 @@ "LIBRARY_OVERVIEW": "媒体库总览" }, "SESSIONS": { - "NO_SESSIONS": "未找到活动会话" + "NO_SESSIONS": "未找到活动会话", + "DIRECT_PLAY": "", + "TRANSCODE": "" }, "STAT_CARDS": { "MOST_VIEWED_MOVIES": "最多观看电影", @@ -301,5 +303,6 @@ "LONGITUDE": "经度", "TIMEZONE": "时区", "POSTCODE": "邮编", - "X_ROWS_SELECTED": "已选中 {ROWS} 行" + "X_ROWS_SELECTED": "已选中 {ROWS} 行", + "SUBTITLES": "" } diff --git a/src/pages/components/sessions/sessions.jsx b/src/pages/components/sessions/sessions.jsx index b540048..d7597f0 100644 --- a/src/pages/components/sessions/sessions.jsx +++ b/src/pages/components/sessions/sessions.jsx @@ -9,6 +9,7 @@ import SessionCard from "./session-card"; import Loading from "../general/loading"; import { Trans } from "react-i18next"; +import i18next from "i18next"; import socket from "../../../socket"; function convertBitrate(bitrate) { @@ -62,10 +63,11 @@ function Sessions() { return ""; } - let transcodeType = "Direct Stream"; + + let transcodeType = i18next.t("SESSIONS.DIRECT_PLAY"); let transcodeVideoCodec = ""; if (row.TranscodingInfo && !row.TranscodingInfo.IsVideoDirect){ - transcodeType = "Transcode"; + transcodeType = i18next.t("SESSIONS.TRANSCODE"); transcodeVideoCodec = ` -> ${row.TranscodingInfo.VideoCodec.toUpperCase()}`; } let bitRate = convertBitrate( @@ -75,7 +77,7 @@ function Sessions() { const originalVideoCodec = videoStream.Codec.toUpperCase(); - return `Video: ${transcodeType} (${originalVideoCodec}${transcodeVideoCodec} - ${bitRate})`; + return `${i18next.t("VIDEO")}: ${transcodeType} (${originalVideoCodec}${transcodeVideoCodec} - ${bitRate})`; } const getAudioStream = (row) => { @@ -85,10 +87,10 @@ function Sessions() { return ""; } - let transcodeType = "Direct Stream"; + let transcodeType = i18next.t("SESSIONS.DIRECT_PLAY"); let transcodeCodec = ""; if (row.TranscodingInfo && !row.TranscodingInfo.IsAudioDirect){ - transcodeType = "Transcode"; + transcodeType = i18next.t("SESSIONS.TRANSCODE"); transcodeCodec = ` -> ${row.TranscodingInfo.AudioCodec.toUpperCase()}`; } @@ -109,8 +111,8 @@ function Sessions() { originalCodec = row.NowPlayingItem.MediaStreams[streamIndex].Codec.toUpperCase(); } - return originalCodec != "" ? `Audio: ${transcodeType} (${originalCodec}${transcodeCodec}${bitRate})` - : `Audio: ${transcodeType}`; + return originalCodec != "" ? `${i18next.t("AUDIO")}: ${transcodeType} (${originalCodec}${transcodeCodec}${bitRate})` + : `${i18next.t("AUDIO")}: ${transcodeType}`; } const getSubtitleStream = (row) => { @@ -127,7 +129,7 @@ function Sessions() { } if (row.NowPlayingItem.MediaStreams && row.NowPlayingItem.MediaStreams.length) { - result = `Subtitles: ${row.NowPlayingItem.MediaStreams[subStreamIndex].DisplayTitle}`; + result = `${i18next.t("SUBTITLES")}: ${row.NowPlayingItem.MediaStreams[subStreamIndex].DisplayTitle}`; } return result;