Localize share URLs and embed code labels

Replaced hardcoded labels for share URLs and embed code in ShareEdit.jsx with localized strings. Added corresponding entries to en.json for improved internationalization support.
This commit is contained in:
Sora 2026-01-19 13:29:19 +08:00
parent 84b6c69593
commit 2313e4d9ea
2 changed files with 8 additions and 3 deletions

View File

@ -561,6 +561,9 @@
"delete_user_title": "Delete user '%{name}'",
"delete_user_content": "Are you sure you want to delete this user and all their data (including playlists and preferences)?",
"remove_missing_title": "Remove missing files",
"shareUrl": "Share URL",
"aplayerEmbedUrl": "APlayer Embed URL",
"navidromeMusicPlayer": "Navidrome Music Player",
"remove_missing_content": "Are you sure you want to remove the selected missing files from the database? This will remove permanently any references to them, including their play counts and ratings.",
"remove_all_missing_title": "Remove all missing files",
"remove_all_missing_content": "Are you sure you want to remove all missing files from the database? This will permanently remove any references to them, including their play counts and ratings.",

View File

@ -5,6 +5,7 @@ import {
NumberField,
SimpleForm,
TextInput,
useTranslate,
} from 'react-admin'
import { sharePlayerUrl, shareAPlayerUrl } from '../utils'
import { Link, Box, Typography, Divider } from '@material-ui/core'
@ -14,6 +15,7 @@ import { EmbedCodeField } from './EmbedCodeField'
export const ShareEdit = (props) => {
const { id, basePath, hasCreate, ...rest } = props
const translate = useTranslate()
const url = sharePlayerUrl(id)
const aplayerUrl = shareAPlayerUrl(id)
return (
@ -21,7 +23,7 @@ export const ShareEdit = (props) => {
<SimpleForm {...rest}>
<Box mb={2}>
<Typography variant="body2" color="textSecondary" gutterBottom>
Share URL
{translate('message.shareUrl')}
</Typography>
<Link href={url} target="_blank" rel="noopener noreferrer">
{url}
@ -29,7 +31,7 @@ export const ShareEdit = (props) => {
</Box>
<Box mb={2}>
<Typography variant="body2" color="textSecondary" gutterBottom>
APlayer Embed URL
{translate('message.aplayerEmbedUrl')}
</Typography>
<Link href={aplayerUrl} target="_blank" rel="noopener noreferrer">
{aplayerUrl}
@ -38,7 +40,7 @@ export const ShareEdit = (props) => {
<Box mb={3}>
<Divider />
</Box>
<EmbedCodeField url={aplayerUrl} title="Navidrome Music Player" />
<EmbedCodeField url={aplayerUrl} title={translate('message.navidromeMusicPlayer')} />
<Box mb={3}>
<Divider />
</Box>