fix(lang): allow proper localization of comma-delimited lists (#1264)

* fix(lang): allow proper localization of comma-delimited lists

* refactor: add string to globals instead, and remove unused strings
This commit is contained in:
TheCatLady
2021-03-22 21:03:02 -04:00
committed by GitHub
parent f5f8269cd2
commit 173408a1f2
6 changed files with 30 additions and 38 deletions

View File

@@ -17,6 +17,7 @@ import TmdbLogo from '../../assets/tmdb_logo.svg';
import { LanguageContext } from '../../context/LanguageContext';
import useSettings from '../../hooks/useSettings';
import { Permission, useUser } from '../../hooks/useUser';
import globalMessages from '../../i18n/globalMessages';
import Error from '../../pages/_error';
import { sortCrewPriority } from '../../utils/creditHelpers';
import Button from '../Common/Button';
@@ -45,11 +46,7 @@ const messages = defineMessages({
cast: 'Cast',
recommendations: 'Recommendations',
similar: 'Similar Series',
cancelrequest: 'Cancel Request',
watchtrailer: 'Watch Trailer',
available: 'Available',
unavailable: 'Unavailable',
pending: 'Pending',
overviewunavailable: 'Overview unavailable.',
manageModalTitle: 'Manage Series',
manageModalRequests: 'Requests',
@@ -57,8 +54,6 @@ const messages = defineMessages({
manageModalClearMedia: 'Clear All Media Data',
manageModalClearMediaWarning:
'* This will irreversibly remove all data for this TV series, including any requests. If this item exists in your Plex library, the media information will be recreated during the next scan.',
approve: 'Approve',
decline: 'Decline',
showtype: 'Series Type',
anime: 'Anime',
network: '{networkCount, plural, one {Network} other {Networks}}',
@@ -200,7 +195,10 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
))
.reduce((prev, curr) => (
<>
{prev}, {curr}
{intl.formatMessage(globalMessages.delimitedlist, {
a: prev,
b: curr,
})}
</>
))
);