From be20a9d116431a96176641fe32d99f973b0b18df Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Tue, 15 Aug 2023 09:18:35 +0200 Subject: [PATCH] Translate Frontend InteractiveSearch (cherry picked from commit efca70438899c2f22e2be060011b58325e4f4705) Closes #9027 --- .../InteractiveSearchContent.js | 41 ++++++++++++------- src/NzbDrone.Core/Localization/Core/en.json | 3 +- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/frontend/src/InteractiveSearch/InteractiveSearchContent.js b/frontend/src/InteractiveSearch/InteractiveSearchContent.js index 27410388f..d1f34e925 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearchContent.js +++ b/frontend/src/InteractiveSearch/InteractiveSearchContent.js @@ -1,11 +1,12 @@ import PropTypes from 'prop-types'; -import React from 'react'; +import React, { Fragment } from 'react'; import Alert from 'Components/Alert'; import Icon from 'Components/Icon'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import Table from 'Components/Table/Table'; import TableBody from 'Components/Table/TableBody'; import { icons, kinds, sortDirections } from 'Helpers/Props'; +import getErrorMessage from 'Utilities/Object/getErrorMessage'; import translate from 'Utilities/String/translate'; import InteractiveSearchRowConnector from './InteractiveSearchRowConnector'; import styles from './InteractiveSearchContent.css'; @@ -128,36 +129,46 @@ function InteractiveSearchContent(props) { onGrabPress } = props; + const errorMessage = getErrorMessage(error); + return (
{ - isFetching && - + isFetching ? : null } { - !isFetching && !!error && + !isFetching && error ? - {translate('UnableToLoadResultsIntSearch')} - + { + errorMessage ? + + {translate('InteractiveSearchResultsFailedErrorMessage', { message: errorMessage.charAt(0).toLowerCase() + errorMessage.slice(1) })} + : + translate('MovieSearchResultsLoadError') + } + : + null } { - !isFetching && isPopulated && !totalReleasesCount && + !isFetching && isPopulated && !totalReleasesCount ? {translate('NoResultsFound')} - + : + null } { - !!totalReleasesCount && isPopulated && !items.length && + !!totalReleasesCount && isPopulated && !items.length ? {translate('AllResultsHiddenFilter')} - + : + null } { - isPopulated && !!items.length && + isPopulated && !!items.length ? -
+ : + null } { - totalReleasesCount !== items.length && !!items.length && + totalReleasesCount !== items.length && !!items.length ? {translate('SomeResultsHiddenFilter')} - + : + null }
); diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index d9998d9cf..61d45c570 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -520,6 +520,7 @@ "InteractiveImportErrMovie": "Movie must be chosen for each selected file", "InteractiveImportErrQuality": "Quality must be chosen for each selected file", "InteractiveSearch": "Interactive Search", + "InteractiveSearchResultsFailedErrorMessage": "Search failed because its {message}. Try refreshing the movie info and verify the necessary information is present before searching again.", "Interval": "Interval", "InvalidFormat": "Invalid Format", "KeepAndUnmonitorMovie": "Keep and Unmonitor Movie", @@ -667,6 +668,7 @@ "MovieMatchType": "Movie Match Type", "MovieNaming": "Movie Naming", "MovieOnly": "Movie Only", + "MovieSearchResultsLoadError": "Unable to load results for this movie search. Try again later", "MovieTitle": "Movie Title", "MovieTitleHelpText": "The title of the movie to exclude (can be anything meaningful)", "MovieYear": "Movie Year", @@ -1217,7 +1219,6 @@ "UnableToLoadQualityProfiles": "Unable to load Quality Profiles", "UnableToLoadRemotePathMappings": "Unable to load Remote Path Mappings", "UnableToLoadRestrictions": "Unable to load Restrictions", - "UnableToLoadResultsIntSearch": "Unable to load results for this movie search. Try again later", "UnableToLoadRootFolders": "Unable to load root folders", "UnableToLoadTags": "Unable to load Tags", "UnableToLoadTheCalendar": "Unable to load the calendar",