Skip to content

Commit

Permalink
Translate Frontend Parse modal
Browse files Browse the repository at this point in the history
  • Loading branch information
stevietv authored and markus101 committed Aug 19, 2023
1 parent 2166e4d commit c14fd2b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
14 changes: 6 additions & 8 deletions frontend/src/Parse/Parse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PageContentBody from 'Components/Page/PageContentBody';
import { icons } from 'Helpers/Props';
import { clear, fetch } from 'Store/Actions/parseActions';
import getErrorMessage from 'Utilities/Object/getErrorMessage';
import translate from 'Utilities/String/translate';
import ParseResult from './ParseResult';
import parseStateSelector from './parseStateSelector';
import styles from './Parse.css';
Expand Down Expand Up @@ -50,7 +51,7 @@ function Parse() {
);

return (
<PageContent title="Parse">
<PageContent title={translate('Parse')}>
<PageContentBody>
<div className={styles.inputContainer}>
<div className={styles.inputIconContainer}>
Expand All @@ -76,15 +77,15 @@ function Parse() {
{!isFetching && !!error ? (
<div className={styles.message}>
<div className={styles.helpText}>
Error parsing, please try again.
{translate('ParseModalErrorParsing')}
</div>
<div>{getErrorMessage(error)}</div>
</div>
) : null}

{!isFetching && title && !error && !item.parsedEpisodeInfo ? (
<div className={styles.message}>
Unable to parse the provided title, please try again.
{translate('ParseModalUnableToParse')}
</div>
) : null}

Expand All @@ -95,12 +96,9 @@ function Parse() {
{title ? null : (
<div className={styles.message}>
<div className={styles.helpText}>
Enter a release title in the input above
</div>
<div>
Sonarr will attempt to parse the title and show you details about
it
{translate('ParseModalHelpText')}
</div>
<div>{translate('ParseModalHelpTextDetails')}</div>
</div>
)}
</PageContentBody>
Expand Down
11 changes: 4 additions & 7 deletions frontend/src/Parse/ParseModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ function ParseModalContent(props: ParseModalContentProps) {
{!isFetching && !!error ? (
<div className={styles.message}>
<div className={styles.helpText}>
Error parsing, please try again.
{translate('ParseModalErrorParsing')}
</div>
<div>{getErrorMessage(error)}</div>
</div>
) : null}

{!isFetching && title && !error && !item.parsedEpisodeInfo ? (
<div className={styles.message}>
Unable to parse the provided title, please try again.
{translate('ParseModalUnableToParse')}
</div>
) : null}

Expand All @@ -105,12 +105,9 @@ function ParseModalContent(props: ParseModalContentProps) {
{title ? null : (
<div className={styles.message}>
<div className={styles.helpText}>
Enter a release title in the input above
</div>
<div>
Sonarr will attempt to parse the title and show you details about
it
{translate('ParseModalHelpText')}
</div>
<div>{translate('ParseModalHelpTextDetails')}</div>
</div>
)}
</ModalBody>
Expand Down
22 changes: 14 additions & 8 deletions frontend/src/Parse/ParseResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,22 @@ function ParseResult(props: ParseResultProps) {
<div className={styles.column}>
<ParseResultItem
title={translate('Special')}
data={special ? 'True' : 'False'}
data={special ? translate('True') : translate('False')}
/>

<ParseResultItem
title={translate('FullSeason')}
data={fullSeason ? 'True' : 'False'}
data={fullSeason ? translate('True') : translate('False')}
/>

<ParseResultItem
title={translate('MultiSeason')}
data={isMultiSeason ? 'True' : 'False'}
data={isMultiSeason ? translate('True') : translate('False')}
/>

<ParseResultItem
title={translate('PartialSeason')}
data={isPartialSeason ? 'True' : 'False'}
data={isPartialSeason ? translate('True') : translate('False')}
/>
</div>
</div>
Expand All @@ -149,14 +149,14 @@ function ParseResult(props: ParseResultProps) {
title={translate('Proper')}
data={
quality.revision.version > 1 && !quality.revision.isRepack
? 'True'
? translate('True')
: '-'
}
/>

<ParseResultItem
title={translate('Repack')}
data={quality.revision.isRepack ? 'True' : '-'}
data={quality.revision.isRepack ? translate('True') : '-'}
/>
</div>

Expand All @@ -170,7 +170,7 @@ function ParseResult(props: ParseResultProps) {

<ParseResultItem
title={translate('Real')}
data={quality.revision.real ? 'True' : '-'}
data={quality.revision.real ? translate('True') : '-'}
/>
</div>
</div>
Expand Down Expand Up @@ -228,7 +228,13 @@ function ParseResult(props: ParseResultProps) {

<ParseResultItem
title={translate('CustomFormats')}
data={<EpisodeFormats formats={customFormats} />}
data={
customFormats && customFormats.length > 0 ? (
<EpisodeFormats formats={customFormats} />
) : (
'-'
)
}
/>

<ParseResultItem
Expand Down
7 changes: 7 additions & 0 deletions src/NzbDrone.Core/Localization/Core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@
"FailedToLoadTranslationsFromApi": "Failed to load translations from API",
"FailedToLoadUiSettingsFromApi": "Failed to load UI settings from API",
"FailedToUpdateSettings": "Failed to update settings",
"False": "False",
"FeatureRequests": "Feature Requests",
"File": "File",
"FileBrowser": "File Browser",
Expand Down Expand Up @@ -829,6 +830,11 @@
"OverrideGrabNoSeries": "Series must be selected",
"PackageVersion": "Package Version",
"PackageVersionInfo": "{packageVersion} by {packageAuthor}",
"Parse": "Parse",
"ParseModalErrorParsing": "Error parsing, please try again.",
"ParseModalHelpText": "Enter a release title in the input above",
"ParseModalHelpTextDetails": "Sonarr will attempt to parse the title and show you details about it",
"ParseModalUnableToParse": "Unable to parse the provided title, please try again.",
"PartialSeason": "Partial Season",
"Password": "Password",
"Path": "Path",
Expand Down Expand Up @@ -1212,6 +1218,7 @@
"TotalRecords": "Total records: {totalRecords}",
"TotalSpace": "Total Space",
"Trace": "Trace",
"True": "True",
"TvdbId": "TVDB ID",
"TvdbIdExcludeHelpText": "The TVDB ID of the series to exclude",
"Twitter": "Twitter",
Expand Down

0 comments on commit c14fd2b

Please sign in to comment.