Skip to content

Commit

Permalink
fix: fix the translations for watchlist permissions and userSettings …
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
Fallenbagel committed Nov 7, 2023
1 parent 67bde68 commit 8c82a61
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
27 changes: 23 additions & 4 deletions src/components/PermissionEdit/index.tsx
@@ -1,7 +1,9 @@
import type { PermissionItem } from '@app/components/PermissionOption';
import PermissionOption from '@app/components/PermissionOption';
import useSettings from '@app/hooks/useSettings';
import type { User } from '@app/hooks/useUser';
import { Permission } from '@app/hooks/useUser';
import { MediaServerType } from '@server/constants/server';
import { defineMessages, useIntl } from 'react-intl';

export const messages = defineMessages({
Expand Down Expand Up @@ -72,9 +74,9 @@ export const messages = defineMessages({
viewrecent: 'View Recently Added',
viewrecentDescription:
'Grant permission to view the list of recently added media.',
viewwatchlists: 'View Plex Watchlists',
viewwatchlists: 'View {mediaServerName} Watchlists',
viewwatchlistsDescription:
"Grant permission to view other users' Plex Watchlists.",
"Grant permission to view other users' {mediaServerName} Watchlists.",
});

interface PermissionEditProps {
Expand All @@ -91,6 +93,7 @@ export const PermissionEdit = ({
onUpdate,
}: PermissionEditProps) => {
const intl = useIntl();
const settings = useSettings();

const permissionList: PermissionItem[] = [
{
Expand Down Expand Up @@ -131,8 +134,24 @@ export const PermissionEdit = ({
},
{
id: 'viewwatchlists',
name: intl.formatMessage(messages.viewwatchlists),
description: intl.formatMessage(messages.viewwatchlistsDescription),
name: intl.formatMessage(messages.viewwatchlists, {
mediaServerName:
settings.currentSettings.mediaServerType === MediaServerType.PLEX
? 'Plex'
: settings.currentSettings.mediaServerType ===
MediaServerType.JELLYFIN
? 'Jellyfin'
: 'Emby',
}),
description: intl.formatMessage(messages.viewwatchlistsDescription, {
mediaServerName:
settings.currentSettings.mediaServerType === MediaServerType.PLEX
? 'Plex'
: settings.currentSettings.mediaServerType ===
MediaServerType.JELLYFIN
? 'Jellyfin'
: 'Emby',
}),
permission: Permission.WATCHLIST_VIEW,
},
],
Expand Down
13 changes: 11 additions & 2 deletions src/components/Settings/SettingsUsers/index.tsx
Expand Up @@ -23,7 +23,7 @@ const messages = defineMessages({
toastSettingsFailure: 'Something went wrong while saving settings.',
localLogin: 'Enable Local Sign-In',
localLoginTip:
'Allow users to sign in using their email address and password, instead of Plex OAuth',
'Allow users to sign in using their email address and password, instead of {mediaServerName} OAuth',
newPlexLogin: 'Enable New {mediaServerName} Sign-In',
newPlexLoginTip:
'Allow {mediaServerName} users to sign in without first being imported',
Expand Down Expand Up @@ -114,7 +114,16 @@ const SettingsUsers = () => {
<label htmlFor="localLogin" className="checkbox-label">
{intl.formatMessage(messages.localLogin)}
<span className="label-tip">
{intl.formatMessage(messages.localLoginTip)}
{intl.formatMessage(messages.localLoginTip, {
mediaServerName:
settings.currentSettings.mediaServerType ===
MediaServerType.PLEX
? 'Plex'
: settings.currentSettings.mediaServerType ===
MediaServerType.JELLYFIN
? 'Jellyfin'
: 'Emby',
})}
</span>
</label>
<div className="form-input-area">
Expand Down
6 changes: 3 additions & 3 deletions src/i18n/locale/en.json
Expand Up @@ -394,8 +394,8 @@
"components.PermissionEdit.viewrecentDescription": "Grant permission to view the list of recently added media.",
"components.PermissionEdit.viewrequests": "View Requests",
"components.PermissionEdit.viewrequestsDescription": "Grant permission to view media requests submitted by other users.",
"components.PermissionEdit.viewwatchlists": "View Plex Watchlists",
"components.PermissionEdit.viewwatchlistsDescription": "Grant permission to view other users' Plex Watchlists.",
"components.PermissionEdit.viewwatchlists": "View {mediaServerName} Watchlists",
"components.PermissionEdit.viewwatchlistsDescription": "Grant permission to view other users' {mediaServerName} Watchlists.",
"components.PersonDetails.alsoknownas": "Also Known As: {names}",
"components.PersonDetails.appearsin": "Appearances",
"components.PersonDetails.ascharacter": "as {character}",
Expand Down Expand Up @@ -852,7 +852,7 @@
"components.Settings.SettingsUsers.defaultPermissions": "Default Permissions",
"components.Settings.SettingsUsers.defaultPermissionsTip": "Initial permissions assigned to new users",
"components.Settings.SettingsUsers.localLogin": "Enable Local Sign-In",
"components.Settings.SettingsUsers.localLoginTip": "Allow users to sign in using their email address and password, instead of Plex OAuth",
"components.Settings.SettingsUsers.localLoginTip": "Allow users to sign in using their email address and password, instead of {mediaServerName} OAuth",
"components.Settings.SettingsUsers.movieRequestLimitLabel": "Global Movie Request Limit",
"components.Settings.SettingsUsers.newPlexLogin": "Enable New {mediaServerName} Sign-In",
"components.Settings.SettingsUsers.newPlexLoginTip": "Allow {mediaServerName} users to sign in without first being imported",
Expand Down

0 comments on commit 8c82a61

Please sign in to comment.