mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-24 02:39:18 -05:00
feat(lang): localize job names (#1043)
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import React from 'react';
|
||||
import useSWR from 'swr';
|
||||
import LoadingSpinner from '../../Common/LoadingSpinner';
|
||||
import { FormattedRelativeTime, defineMessages, useIntl } from 'react-intl';
|
||||
import {
|
||||
FormattedRelativeTime,
|
||||
defineMessages,
|
||||
useIntl,
|
||||
MessageDescriptor,
|
||||
} from 'react-intl';
|
||||
import Button from '../../Common/Button';
|
||||
import Table from '../../Common/Table';
|
||||
import Spinner from '../../../assets/spinner.svg';
|
||||
@@ -11,7 +16,7 @@ import Badge from '../../Common/Badge';
|
||||
import { CacheItem } from '../../../../server/interfaces/api/settingsInterfaces';
|
||||
import { formatBytes } from '../../../utils/numberHelpers';
|
||||
|
||||
const messages = defineMessages({
|
||||
const messages: { [messageName: string]: MessageDescriptor } = defineMessages({
|
||||
jobs: 'Jobs',
|
||||
jobsDescription:
|
||||
'Overseerr performs certain maintenance tasks as regularly-scheduled jobs, but they can also be manually triggered below. Manually running a job will not alter its schedule.',
|
||||
@@ -35,6 +40,13 @@ const messages = defineMessages({
|
||||
cacheksize: 'Key Size',
|
||||
cachevsize: 'Value Size',
|
||||
flushcache: 'Flush Cache',
|
||||
unknownJob: 'Unknown Job',
|
||||
'plex-recently-added-sync': 'Plex Recently Added Sync',
|
||||
'plex-full-sync': 'Plex Full Library Sync',
|
||||
'radarr-sync': 'Radarr Sync',
|
||||
'sonarr-sync': 'Sonarr Sync',
|
||||
'download-sync': 'Download Sync',
|
||||
'download-sync-reset': 'Download Sync Reset',
|
||||
});
|
||||
|
||||
interface Job {
|
||||
@@ -66,7 +78,7 @@ const SettingsJobs: React.FC = () => {
|
||||
await axios.post(`/api/v1/settings/jobs/${job.id}/run`);
|
||||
addToast(
|
||||
intl.formatMessage(messages.jobstarted, {
|
||||
jobname: job.name,
|
||||
jobname: intl.formatMessage(messages[job.id] ?? messages.unknownJob),
|
||||
}),
|
||||
{
|
||||
appearance: 'success',
|
||||
@@ -78,10 +90,15 @@ const SettingsJobs: React.FC = () => {
|
||||
|
||||
const cancelJob = async (job: Job) => {
|
||||
await axios.post(`/api/v1/settings/jobs/${job.id}/cancel`);
|
||||
addToast(intl.formatMessage(messages.jobcancelled, { jobname: job.name }), {
|
||||
appearance: 'error',
|
||||
autoDismiss: true,
|
||||
});
|
||||
addToast(
|
||||
intl.formatMessage(messages.jobcancelled, {
|
||||
jobname: intl.formatMessage(messages[job.id] ?? messages.unknownJob),
|
||||
}),
|
||||
{
|
||||
appearance: 'error',
|
||||
autoDismiss: true,
|
||||
}
|
||||
);
|
||||
revalidate();
|
||||
};
|
||||
|
||||
@@ -121,7 +138,11 @@ const SettingsJobs: React.FC = () => {
|
||||
<Table.TD>
|
||||
<div className="flex items-center text-sm leading-5 text-white">
|
||||
{job.running && <Spinner className="w-5 h-5 mr-2" />}
|
||||
<span>{job.name}</span>
|
||||
<span>
|
||||
{intl.formatMessage(
|
||||
messages[job.id] ?? messages.unknownJob
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</Table.TD>
|
||||
<Table.TD>
|
||||
|
||||
@@ -411,6 +411,8 @@
|
||||
"components.Settings.SettingsJobsCache.cachevsize": "Value Size",
|
||||
"components.Settings.SettingsJobsCache.canceljob": "Cancel Job",
|
||||
"components.Settings.SettingsJobsCache.command": "Command",
|
||||
"components.Settings.SettingsJobsCache.download-sync": "Download Sync",
|
||||
"components.Settings.SettingsJobsCache.download-sync-reset": "Download Sync Reset",
|
||||
"components.Settings.SettingsJobsCache.flushcache": "Flush Cache",
|
||||
"components.Settings.SettingsJobsCache.jobcancelled": "{jobname} canceled.",
|
||||
"components.Settings.SettingsJobsCache.jobname": "Job Name",
|
||||
@@ -419,8 +421,13 @@
|
||||
"components.Settings.SettingsJobsCache.jobstarted": "{jobname} started.",
|
||||
"components.Settings.SettingsJobsCache.jobtype": "Type",
|
||||
"components.Settings.SettingsJobsCache.nextexecution": "Next Execution",
|
||||
"components.Settings.SettingsJobsCache.plex-full-sync": "Plex Full Library Sync",
|
||||
"components.Settings.SettingsJobsCache.plex-recently-added-sync": "Plex Recently Added Sync",
|
||||
"components.Settings.SettingsJobsCache.process": "Process",
|
||||
"components.Settings.SettingsJobsCache.radarr-sync": "Radarr Sync",
|
||||
"components.Settings.SettingsJobsCache.runnow": "Run Now",
|
||||
"components.Settings.SettingsJobsCache.sonarr-sync": "Sonarr Sync",
|
||||
"components.Settings.SettingsJobsCache.unknownJob": "Unknown Job",
|
||||
"components.Settings.SonarrModal.add": "Add Server",
|
||||
"components.Settings.SonarrModal.animelanguageprofile": "Anime Language Profile",
|
||||
"components.Settings.SonarrModal.animequalityprofile": "Anime Quality Profile",
|
||||
|
||||
Reference in New Issue
Block a user