From 866fbc7f093c34e4414734f90e756e2f6870d84a Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Fri, 18 Aug 2023 13:51:33 +0200 Subject: [PATCH] Translate Frontend Organize + Rename modal including changing SeasonNumber component to formatSeason function --- .../Organize/OrganizePreviewModalContent.js | 29 +++++++++---------- frontend/src/Season/SeasonNumber.js | 29 ------------------- frontend/src/Season/formatSeason.ts | 13 +++++++++ .../History/SeriesHistoryModalContent.js | 4 +-- .../SeasonInteractiveSearchModalContent.js | 4 +-- src/NzbDrone.Core/Localization/Core/en.json | 8 +++++ 6 files changed, 39 insertions(+), 48 deletions(-) delete mode 100644 frontend/src/Season/SeasonNumber.js create mode 100644 frontend/src/Season/formatSeason.ts diff --git a/frontend/src/Organize/OrganizePreviewModalContent.js b/frontend/src/Organize/OrganizePreviewModalContent.js index 7f8d4c7e8..bb1ab3355 100644 --- a/frontend/src/Organize/OrganizePreviewModalContent.js +++ b/frontend/src/Organize/OrganizePreviewModalContent.js @@ -4,12 +4,14 @@ import Alert from 'Components/Alert'; import CheckInput from 'Components/Form/CheckInput'; import Button from 'Components/Link/Button'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; +import InlineMarkdown from 'Components/Markdown/InlineMarkdown'; import ModalBody from 'Components/Modal/ModalBody'; import ModalContent from 'Components/Modal/ModalContent'; import ModalFooter from 'Components/Modal/ModalFooter'; import ModalHeader from 'Components/Modal/ModalHeader'; import { kinds } from 'Helpers/Props'; -import SeasonNumber from 'Season/SeasonNumber'; +import formatSeason from 'Season/formatSeason'; +import translate from 'Utilities/String/translate'; import getSelectedIds from 'Utilities/Table/getSelectedIds'; import selectAll from 'Utilities/Table/selectAll'; import toggleSelected from 'Utilities/Table/toggleSelected'; @@ -93,7 +95,10 @@ class OrganizePreviewModalContent extends Component { return ( - Organize & Rename {seasonNumber != null && } + { seasonNumber == null ? + translate('OrganizeModalHeader') : + translate('OrganizeModalHeaderSeason', { season: formatSeason(seasonNumber) }) + } @@ -104,7 +109,7 @@ class OrganizePreviewModalContent extends Component { { !isFetching && error && -
Error loading previews
+
{translate('OrganizeLoadError')}
} { @@ -112,8 +117,8 @@ class OrganizePreviewModalContent extends Component {
{ renameEpisodes ? -
Success! My work is done, no files to rename.
: -
Renaming is disabled, nothing to rename
+
{translate('OrganizeNothingToRename')}
: +
{translate('OrganizeRenamingDisabled')}
}
} @@ -123,17 +128,11 @@ class OrganizePreviewModalContent extends Component {
- All paths are relative to: - - {path} - +
- Naming pattern: - - {episodeFormat} - +
@@ -172,14 +171,14 @@ class OrganizePreviewModalContent extends Component { diff --git a/frontend/src/Season/SeasonNumber.js b/frontend/src/Season/SeasonNumber.js deleted file mode 100644 index 8db967243..000000000 --- a/frontend/src/Season/SeasonNumber.js +++ /dev/null @@ -1,29 +0,0 @@ -import PropTypes from 'prop-types'; - -function SeasonNumber(props) { - const { - seasonNumber, - separator - } = props; - - if (seasonNumber === 0) { - return `${separator}Specials`; - } - - if (seasonNumber > 0) { - return `${separator}Season ${seasonNumber}`; - } - - return null; -} - -SeasonNumber.propTypes = { - seasonNumber: PropTypes.number.isRequired, - separator: PropTypes.string.isRequired -}; - -SeasonNumber.defaultProps = { - separator: '- ' -}; - -export default SeasonNumber; diff --git a/frontend/src/Season/formatSeason.ts b/frontend/src/Season/formatSeason.ts new file mode 100644 index 000000000..d3fc4a439 --- /dev/null +++ b/frontend/src/Season/formatSeason.ts @@ -0,0 +1,13 @@ +import translate from 'Utilities/String/translate'; + +export default function formatSeason(seasonNumber: number) { + if (seasonNumber === 0) { + return translate('Specials'); + } + + if (seasonNumber > 0) { + return translate('SeasonNumberToken', { seasonNumber }); + } + + return null; +} diff --git a/frontend/src/Series/History/SeriesHistoryModalContent.js b/frontend/src/Series/History/SeriesHistoryModalContent.js index 547d8ae93..d16ff1df6 100644 --- a/frontend/src/Series/History/SeriesHistoryModalContent.js +++ b/frontend/src/Series/History/SeriesHistoryModalContent.js @@ -11,7 +11,7 @@ import ModalHeader from 'Components/Modal/ModalHeader'; import Table from 'Components/Table/Table'; import TableBody from 'Components/Table/TableBody'; import { icons, kinds } from 'Helpers/Props'; -import SeasonNumber from 'Season/SeasonNumber'; +import formatSeason from 'Season/formatSeason'; import translate from 'Utilities/String/translate'; import SeriesHistoryRowConnector from './SeriesHistoryRowConnector'; @@ -88,7 +88,7 @@ class SeriesHistoryModalContent extends Component { return ( - History {seasonNumber != null && } + History {seasonNumber != null && formatSeason(seasonNumber)} diff --git a/frontend/src/Series/Search/SeasonInteractiveSearchModalContent.js b/frontend/src/Series/Search/SeasonInteractiveSearchModalContent.js index f301f062e..69c44746a 100644 --- a/frontend/src/Series/Search/SeasonInteractiveSearchModalContent.js +++ b/frontend/src/Series/Search/SeasonInteractiveSearchModalContent.js @@ -7,7 +7,7 @@ import ModalFooter from 'Components/Modal/ModalFooter'; import ModalHeader from 'Components/Modal/ModalHeader'; import { scrollDirections } from 'Helpers/Props'; import InteractiveSearchConnector from 'InteractiveSearch/InteractiveSearchConnector'; -import SeasonNumber from 'Season/SeasonNumber'; +import formatSeason from 'Season/formatSeason'; function SeasonInteractiveSearchModalContent(props) { const { @@ -19,7 +19,7 @@ function SeasonInteractiveSearchModalContent(props) { return ( - Interactive Search {seasonNumber != null && } + Interactive Search {seasonNumber != null && formatSeason(seasonNumber)} diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 7786c653c..79c9c82af 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -818,6 +818,14 @@ "OptionalName": "Optional name", "Options": "Options", "Or": "or", + "Organize": "Organize", + "OrganizeLoadError": "Error loading previews", + "OrganizeModalHeader": "Organize & Rename", + "OrganizeModalHeaderSeason": "Organize & Rename - {season}", + "OrganizeNamingPattern": "Naming pattern: `{episodeFormat}`", + "OrganizeNothingToRename": "Success! My work is done, no files to rename.", + "OrganizeRelativePaths": "All paths are relative to: `{path}`", + "OrganizeRenamingDisabled": "Renaming is disabled, nothing to rename", "Original": "Original", "OriginalLanguage": "Original Language", "Other": "Other",