From 7220635d79575a201826e5b5e8523238b58d8903 Mon Sep 17 00:00:00 2001 From: Ivelin Megdanov Date: Wed, 26 Feb 2025 12:05:17 +0200 Subject: [PATCH 1/4] Show catalog names while loading --- src/routes/Search/Search.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/routes/Search/Search.js b/src/routes/Search/Search.js index 4b052ed46..abfa99740 100644 --- a/src/routes/Search/Search.js +++ b/src/routes/Search/Search.js @@ -4,7 +4,7 @@ const React = require('react'); const PropTypes = require('prop-types'); const classnames = require('classnames'); const debounce = require('lodash.debounce'); -const { useTranslation } = require('react-i18next'); +const useTranslate = require('stremio/common/useTranslate'); const { default: Icon } = require('@stremio/stremio-icons/react'); const { withCoreSuspender, getVisibleChildrenRange } = require('stremio/common'); const { Image, MainNavBars, MetaItem, MetaRow } = require('stremio/components'); @@ -14,7 +14,7 @@ const styles = require('./styles'); const THRESHOLD = 100; const Search = ({ queryParams }) => { - const { t } = useTranslation(); + const t = useTranslate(); const [search, loadSearchRows] = useSearch(queryParams); const query = React.useMemo(() => { return search.selected !== null ? @@ -52,24 +52,24 @@ const Search = ({ queryParams }) => { query === null ?
-
{t('SEARCH_ANYTHING')}
+
{t.string('SEARCH_ANYTHING')}
-
{t('SEARCH_CATEGORIES')}
+
{t.string('SEARCH_CATEGORIES')}
-
{t('SEARCH_PERSONS')}
+
{t.string('SEARCH_PERSONS')}
-
{t('SEARCH_PROTOCOLS')}
+
{t.string('SEARCH_PROTOCOLS')}
-
{t('SEARCH_TYPES')}
+
{t.string('SEARCH_TYPES')}
@@ -81,7 +81,7 @@ const Search = ({ queryParams }) => { src={require('/images/empty.png')} alt={' '} /> -
{ t('STREMIO_TV_SEARCH_NO_ADDONS') }
+
{ t.string('STREMIO_TV_SEARCH_NO_ADDONS') }
: search.catalogs.map((catalog, index) => { @@ -110,11 +110,13 @@ const Search = ({ queryParams }) => { return null; } default: { + const loadingTitle = `${catalog.addon.manifest.name}: ${t.catalogTitle(catalog)}`; return ( ); } From 3d56023ffd662f9eb905eb3ea3ee2355f2ae0f38 Mon Sep 17 00:00:00 2001 From: Ivelin Megdanov Date: Wed, 26 Feb 2025 12:25:47 +0200 Subject: [PATCH 2/4] Added addon name to catalogTitle function --- src/common/useTranslate.js | 3 ++- src/routes/Search/Search.js | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/useTranslate.js b/src/common/useTranslate.js index 7214a4a1e..342b27dcf 100644 --- a/src/common/useTranslate.js +++ b/src/common/useTranslate.js @@ -21,10 +21,11 @@ const useTranslate = () => { if (addon && id && name) { const partialKey = `${addon.manifest.id.split('.').join('_')}_${id}`; const translatedName = stringWithPrefix(partialKey, 'CATALOG_', name); + const addonName = addon.manifest.name; if (type && withType) { const translatedType = stringWithPrefix(type, 'TYPE_'); - return `${translatedName} - ${translatedType}`; + return `${addonName}: ${translatedName} - ${translatedType}`; } return translatedName; diff --git a/src/routes/Search/Search.js b/src/routes/Search/Search.js index abfa99740..58e6e834b 100644 --- a/src/routes/Search/Search.js +++ b/src/routes/Search/Search.js @@ -110,13 +110,12 @@ const Search = ({ queryParams }) => { return null; } default: { - const loadingTitle = `${catalog.addon.manifest.name}: ${t.catalogTitle(catalog)}`; return ( ); } From 6420b5e0c95f82df3414e9949f100724cf1cd3fc Mon Sep 17 00:00:00 2001 From: Ivelin Megdanov Date: Wed, 26 Feb 2025 12:30:59 +0200 Subject: [PATCH 3/4] Added the loading title to the Board --- src/routes/Board/Board.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/routes/Board/Board.js b/src/routes/Board/Board.js index 9e721edf2..13acb4a86 100644 --- a/src/routes/Board/Board.js +++ b/src/routes/Board/Board.js @@ -3,7 +3,7 @@ const React = require('react'); const classnames = require('classnames'); const debounce = require('lodash.debounce'); -const { useTranslation } = require('react-i18next'); +const useTranslate = require('stremio/common/useTranslate'); const { useStreamingServer, useNotifications, withCoreSuspender, getVisibleChildrenRange, useProfile } = require('stremio/common'); const { ContinueWatchingItem, EventModal, MainNavBars, MetaItem, MetaRow } = require('stremio/components'); const useBoard = require('./useBoard'); @@ -14,7 +14,7 @@ const { default: StreamingServerWarning } = require('./StreamingServerWarning'); const THRESHOLD = 5; const Board = () => { - const { t } = useTranslation(); + const t = useTranslate(); const streamingServer = useStreamingServer(); const continueWatchingPreview = useContinueWatchingPreview(); const [board, loadBoardRows] = useBoard(); @@ -55,7 +55,7 @@ const Board = () => { continueWatchingPreview.items.length > 0 ? { key={index} className={classnames(styles['board-row'], styles['board-row-poster'], 'animation-fade-in')} catalog={catalog} + title={t.catalogTitle(catalog)} /> ); } From fef0a57ac719b721fca2571a1c0760257569ed91 Mon Sep 17 00:00:00 2001 From: Ivelin Megdanov Date: Thu, 27 Feb 2025 13:41:30 +0200 Subject: [PATCH 4/4] Removed addon name from catalog title --- src/common/useTranslate.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common/useTranslate.js b/src/common/useTranslate.js index 342b27dcf..7214a4a1e 100644 --- a/src/common/useTranslate.js +++ b/src/common/useTranslate.js @@ -21,11 +21,10 @@ const useTranslate = () => { if (addon && id && name) { const partialKey = `${addon.manifest.id.split('.').join('_')}_${id}`; const translatedName = stringWithPrefix(partialKey, 'CATALOG_', name); - const addonName = addon.manifest.name; if (type && withType) { const translatedType = stringWithPrefix(type, 'TYPE_'); - return `${addonName}: ${translatedName} - ${translatedType}`; + return `${translatedName} - ${translatedType}`; } return translatedName;