i18n: extract the settings screens your pass didn't reach (settings)

Part of #145.

`8c9bf0d` localized the settings views themselves; these eight files sit
in the same zone but were not in that pass: the subscription modal, the
child-user creation and password-change modals, both payment result
views, developer settings, and the backup/restore and account-deletion
modals.

Extends the `settings` namespace you established, following its key
naming — 59 keys added to `en/settings.json`. `src/i18n/config.js` is
untouched.

English only — no translations, no behaviour change. Every t() value is
checked against this branch's base: the string must appear
character-for-character in the code it replaces (71 call sites).

One deliberate structural detail: in `BackupRestoreModal` the warning
reads `<strong>Warning:</strong> Restoring a backup will…`. The label and
the sentence are separate keys and the `<strong>` stays in the JSX, so the
emphasis survives and no markup ends up in the dictionary.

If you'd rather keep developer settings hardcoded, say so and I'll drop
that file — it is the one screen here an end user never sees.
This commit is contained in:
everysingletear
2026-08-13 10:18:10 +08:00
parent 7eba12e718
commit 0e98a556da
9 changed files with 162 additions and 76 deletions
+12 -11
View File
@@ -14,8 +14,10 @@ import ModalActions from '../../../components/common/ModalActions'
import { useNavigate } from 'react-router-dom'
import { useResponsiveModal } from '../../../hooks/useResponsiveModal'
import { CheckUserDeletion, DeleteUser } from '../../../utils/Fetcher'
import { useTranslation } from 'react-i18next'
function UserDeletionModal({ isOpen, onClose }) {
const { t } = useTranslation('settings')
const { ResponsiveModal } = useResponsiveModal()
const Navigate = useNavigate()
const [step, setStep] = useState(1) // 1: Warning, 2: Transfer, 3: Confirm
@@ -47,7 +49,7 @@ function UserDeletionModal({ isOpen, onClose }) {
const checkDeletionRequirements = async () => {
if (password.trim() === '') {
setError('Please enter your password to continue')
setError(t('deletion.passwordRequired'))
return
}
@@ -97,7 +99,7 @@ function UserDeletionModal({ isOpen, onClose }) {
const executeUserDeletion = async () => {
if (password.trim() === '' || confirmation !== 'DELETE') {
setError('Please enter your password and type DELETE to confirm')
setError(t('deletion.passwordAndDelete'))
return
}
@@ -120,7 +122,7 @@ function UserDeletionModal({ isOpen, onClose }) {
}
} catch (err) {
console.error('Failed to delete account:', err)
setError('Failed to delete account')
setError(t('deletion.failed'))
} finally {
setLoading(false)
}
@@ -181,7 +183,7 @@ function UserDeletionModal({ isOpen, onClose }) {
type='password'
value={password}
onChange={e => setPassword(e.target.value)}
placeholder='Enter your password'
placeholder={t('deletion.passwordPlaceholder')}
/>
</FormControl>
@@ -196,7 +198,7 @@ function UserDeletionModal({ isOpen, onClose }) {
const renderTransferStep = () => (
<>
<Typography level='body-md' mb={3}>
You own circles that require ownership transfer before deletion. Please
{t('deletion.transferIntro')}
select new owners:
</Typography>
@@ -208,7 +210,7 @@ function UserDeletionModal({ isOpen, onClose }) {
<FormControl>
<FormLabel>New Owner</FormLabel>
<Select
placeholder='Select new owner'
placeholder={t('deletion.selectOwner')}
value={
transferOptions.find(t => t.circleId === circle.id)
?.newOwnerId || ''
@@ -237,8 +239,7 @@ function UserDeletionModal({ isOpen, onClose }) {
const renderConfirmationStep = () => (
<>
<Typography level='body-md' mb={3}>
Please enter your password and type <strong>DELETE</strong> to confirm
account deletion.
{t('deletion.confirmPrompt')}
</Typography>
<Typography level='body-sm' mb={2}>
on successful deletion, you will be logged out and redirected to the
@@ -251,7 +252,7 @@ function UserDeletionModal({ isOpen, onClose }) {
type='password'
value={password}
onChange={e => setPassword(e.target.value)}
placeholder='Enter your password'
placeholder={t('deletion.passwordPlaceholder')}
/>
</FormControl>
@@ -260,7 +261,7 @@ function UserDeletionModal({ isOpen, onClose }) {
<Input
value={confirmation}
onChange={e => setConfirmation(e.target.value)}
placeholder='DELETE'
placeholder={t('deletion.typeDelete')}
/>
</FormControl>
@@ -304,7 +305,7 @@ function UserDeletionModal({ isOpen, onClose }) {
<ModalActions
stackOnMobile
secondary={{
label: 'Cancel',
label: t('accountSettings.cancel'),
onClick: () => handleClose(false),
}}
primary={{