Translate Frontend Organize + Rename modal
including changing SeasonNumber component to formatSeason function
This commit is contained in:
parent
0feee19146
commit
866fbc7f09
|
@ -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 (
|
||||
<ModalContent onModalClose={onModalClose}>
|
||||
<ModalHeader>
|
||||
Organize & Rename {seasonNumber != null && <SeasonNumber seasonNumber={seasonNumber} />}
|
||||
{ seasonNumber == null ?
|
||||
translate('OrganizeModalHeader') :
|
||||
translate('OrganizeModalHeaderSeason', { season: formatSeason(seasonNumber) })
|
||||
}
|
||||
</ModalHeader>
|
||||
|
||||
<ModalBody>
|
||||
|
@ -104,7 +109,7 @@ class OrganizePreviewModalContent extends Component {
|
|||
|
||||
{
|
||||
!isFetching && error &&
|
||||
<div>Error loading previews</div>
|
||||
<div>{translate('OrganizeLoadError')}</div>
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -112,8 +117,8 @@ class OrganizePreviewModalContent extends Component {
|
|||
<div>
|
||||
{
|
||||
renameEpisodes ?
|
||||
<div>Success! My work is done, no files to rename.</div> :
|
||||
<div>Renaming is disabled, nothing to rename</div>
|
||||
<div>{translate('OrganizeNothingToRename')}</div> :
|
||||
<div>{translate('OrganizeRenamingDisabled')}</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
@ -123,17 +128,11 @@ class OrganizePreviewModalContent extends Component {
|
|||
<div>
|
||||
<Alert>
|
||||
<div>
|
||||
All paths are relative to:
|
||||
<span className={styles.path}>
|
||||
{path}
|
||||
</span>
|
||||
<InlineMarkdown data={translate('OrganizeRelativePaths', { path })} blockClassName={styles.path} />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
Naming pattern:
|
||||
<span className={styles.episodeFormat}>
|
||||
{episodeFormat}
|
||||
</span>
|
||||
<InlineMarkdown data={translate('OrganizeNamingPattern', { episodeFormat })} blockClassName={styles.episodeFormat} />
|
||||
</div>
|
||||
</Alert>
|
||||
|
||||
|
@ -172,14 +171,14 @@ class OrganizePreviewModalContent extends Component {
|
|||
<Button
|
||||
onPress={onModalClose}
|
||||
>
|
||||
Cancel
|
||||
{translate('Cancel')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
kind={kinds.PRIMARY}
|
||||
onPress={this.onOrganizePress}
|
||||
>
|
||||
Organize
|
||||
{translate('Organize')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</ModalContent>
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
||||
}
|
|
@ -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 (
|
||||
<ModalContent onModalClose={onModalClose}>
|
||||
<ModalHeader>
|
||||
History {seasonNumber != null && <SeasonNumber seasonNumber={seasonNumber} />}
|
||||
History {seasonNumber != null && formatSeason(seasonNumber)}
|
||||
</ModalHeader>
|
||||
|
||||
<ModalBody>
|
||||
|
|
|
@ -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 (
|
||||
<ModalContent onModalClose={onModalClose}>
|
||||
<ModalHeader>
|
||||
Interactive Search {seasonNumber != null && <SeasonNumber seasonNumber={seasonNumber} />}
|
||||
Interactive Search {seasonNumber != null && formatSeason(seasonNumber)}
|
||||
</ModalHeader>
|
||||
|
||||
<ModalBody scrollDirection={scrollDirections.BOTH}>
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue