From 8c82a61450a7525c0e2f1b64e6939da47a7c715d Mon Sep 17 00:00:00 2001 From: fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Wed, 8 Nov 2023 01:24:18 +0500 Subject: [PATCH] fix: fix the translations for watchlist permissions and userSettings page --- src/components/PermissionEdit/index.tsx | 27 ++++++++++++++++--- .../Settings/SettingsUsers/index.tsx | 13 +++++++-- src/i18n/locale/en.json | 6 ++--- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/components/PermissionEdit/index.tsx b/src/components/PermissionEdit/index.tsx index 768b9281c..82971bf03 100644 --- a/src/components/PermissionEdit/index.tsx +++ b/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({ @@ -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 { @@ -91,6 +93,7 @@ export const PermissionEdit = ({ onUpdate, }: PermissionEditProps) => { const intl = useIntl(); + const settings = useSettings(); const permissionList: PermissionItem[] = [ { @@ -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, }, ], diff --git a/src/components/Settings/SettingsUsers/index.tsx b/src/components/Settings/SettingsUsers/index.tsx index e420977b1..ff6126c5e 100644 --- a/src/components/Settings/SettingsUsers/index.tsx +++ b/src/components/Settings/SettingsUsers/index.tsx @@ -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', @@ -114,7 +114,16 @@ const SettingsUsers = () => {
diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index d355b6efd..906892b04 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -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}", @@ -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",