Skip to content

Commit 3492e74

Browse files
i18n: translate all client pages (FR/EN)
Converts the remaining hardcoded French UI strings to t('...') across Drive, Shares, Remote, Account, Admin (+ UpdatePanel), Quick-Upload, the public share client, the vault redirect, the error boundary, and the overlay default labels. No behavior or styling changes. Server-rendered metadata, legal pages, not-found, and global-error (renders outside the provider) are intentionally left as-is. Verified: 314 keys per language (fr/en fully parallel), every used key defined, web typecheck + lint + production build all pass.
1 parent 4d7f017 commit 3492e74

11 files changed

Lines changed: 267 additions & 241 deletions

File tree

‎apps/web/src/app/(app)/account/page.tsx‎

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useCallback, useEffect, useState } from 'react';
88
import { useRouter } from 'next/navigation';
99
import { api, API_URL, ApiError } from '@/lib/api';
1010
import { useAuth } from '@/lib/auth';
11+
import { useT } from '@/lib/i18n';
1112
import { prompt } from '@/components/ui/overlays';
1213

1314
interface TwoFaStatus {
@@ -30,6 +31,7 @@ interface SessionInfo {
3031

3132
export default function AccountPage() {
3233
const { refresh } = useAuth();
34+
const { t } = useT();
3335
const router = useRouter();
3436
const [status, setStatus] = useState<TwoFaStatus | null>(null);
3537
const [setup, setSetup] = useState<SetupData | null>(null);
@@ -75,7 +77,7 @@ export default function AccountPage() {
7577
}
7678

7779
async function disable() {
78-
const password = await prompt({ title: 'Désactiver la 2FA', label: 'Confirmez votre mot de passe', password: true });
80+
const password = await prompt({ title: t('account.disable2faTitle'), label: t('account.confirmPassword'), password: true });
7981
if (!password) return;
8082
await wrap(async () => {
8183
await api.post('/2fa/disable', { password });
@@ -85,7 +87,7 @@ export default function AccountPage() {
8587
}
8688

8789
async function regenerate() {
88-
const password = await prompt({ title: 'Régénérer les codes de secours', label: 'Confirmez votre mot de passe', password: true });
90+
const password = await prompt({ title: t('account.regenTitle'), label: t('account.confirmPassword'), password: true });
8991
if (!password) return;
9092
await wrap(async () => {
9193
const res = await api.post<{ recoveryCodes: string[] }>('/2fa/recovery/regenerate', { password });
@@ -109,9 +111,9 @@ export default function AccountPage() {
109111

110112
async function deleteAccount() {
111113
const password = await prompt({
112-
title: 'Supprimer le compte',
113-
message: 'Cette action supprime définitivement votre compte et tous vos fichiers. Irréversible.',
114-
label: 'Confirmez votre mot de passe',
114+
title: t('account.deleteTitle'),
115+
message: t('account.deleteMsg'),
116+
label: t('account.confirmPassword'),
115117
password: true,
116118
});
117119
if (!password) return;
@@ -124,22 +126,22 @@ export default function AccountPage() {
124126

125127
return (
126128
<div className="space-y-8">
127-
<h1 className="text-lg font-semibold">Account security</h1>
129+
<h1 className="text-lg font-semibold">{t('account.title')}</h1>
128130
{error && <p className="text-sm text-red-600">{error}</p>}
129131

130132
{/* Two-factor */}
131133
<section className="card space-y-3">
132134
<div className="flex items-center justify-between">
133-
<h2 className="font-semibold">Two-factor authentication</h2>
135+
<h2 className="font-semibold">{t('account.twoFa')}</h2>
134136
<span className="text-xs text-neutral-400">
135-
{status?.enabled ? `On · ${status.recoveryCodesRemaining} recovery codes left` : 'Off'}
137+
{status?.enabled ? t('account.twoFaOn', { count: status.recoveryCodesRemaining }) : t('account.twoFaOff')}
136138
</span>
137139
</div>
138140

139141
{recoveryCodes && (
140142
<div className="rounded border border-amber-300 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-950">
141143
<p className="mb-2 text-sm font-medium text-amber-800 dark:text-amber-200">
142-
Save these recovery codes now. They are shown only once and each works a single time.
144+
{t('account.saveCodes')}
143145
</p>
144146
<div className="grid grid-cols-2 gap-1 font-mono text-sm">
145147
{recoveryCodes.map((c) => (
@@ -151,19 +153,19 @@ export default function AccountPage() {
151153

152154
{!status?.enabled && !setup && (
153155
<button className="btn-primary" onClick={beginSetup}>
154-
Enable two-factor
156+
{t('account.enable2fa')}
155157
</button>
156158
)}
157159

158160
{!status?.enabled && setup && (
159161
<div className="space-y-3">
160162
<p className="text-sm text-neutral-500">
161-
Scan this with Google Authenticator (or any TOTP app), then enter the 6-digit code.
163+
{t('account.scanHint')}
162164
</p>
163165
{/* eslint-disable-next-line @next/next/no-img-element */}
164-
<img src={setup.qrDataUrl} alt="TOTP QR code" className="h-44 w-44 rounded bg-white p-2" />
166+
<img src={setup.qrDataUrl} alt={t('account.qrAlt')} className="h-44 w-44 rounded bg-white p-2" />
165167
<p className="break-all text-xs text-neutral-400">
166-
Or enter this secret manually: <code className="font-mono">{setup.secret}</code>
168+
{t('account.manualSecret')} <code className="font-mono">{setup.secret}</code>
167169
</p>
168170
<div className="flex gap-2">
169171
<input
@@ -174,7 +176,7 @@ export default function AccountPage() {
174176
onChange={(e) => setToken(e.target.value)}
175177
/>
176178
<button className="btn-primary" onClick={enable}>
177-
Verify &amp; enable
179+
{t('account.verifyEnable')}
178180
</button>
179181
</div>
180182
</div>
@@ -183,10 +185,10 @@ export default function AccountPage() {
183185
{status?.enabled && (
184186
<div className="flex gap-2">
185187
<button className="btn-ghost" onClick={regenerate}>
186-
Regenerate recovery codes
188+
{t('account.regenCodes')}
187189
</button>
188190
<button className="btn-danger" onClick={disable}>
189-
Disable two-factor
191+
{t('account.disable2fa')}
190192
</button>
191193
</div>
192194
)}
@@ -195,26 +197,26 @@ export default function AccountPage() {
195197
{/* Sessions */}
196198
<section className="card space-y-3">
197199
<div className="flex items-center justify-between">
198-
<h2 className="font-semibold">Active sessions</h2>
200+
<h2 className="font-semibold">{t('account.sessions')}</h2>
199201
<button className="btn-ghost px-2 py-1" onClick={revokeOthers}>
200-
Sign out other sessions
202+
{t('account.signoutOthers')}
201203
</button>
202204
</div>
203205
<div className="divide-y divide-neutral-100 dark:divide-neutral-800">
204206
{sessions.map((s) => (
205207
<div key={s.id} className="flex items-center justify-between gap-2 py-2 text-sm">
206208
<div className="min-w-0">
207209
<p className="truncate">
208-
{s.ip ?? 'unknown IP'}
209-
{s.current && <span className="ml-2 text-xs text-accent">this device</span>}
210+
{s.ip ?? t('account.unknownIp')}
211+
{s.current && <span className="ml-2 text-xs text-accent">{t('account.thisDevice')}</span>}
210212
</p>
211213
<p className="truncate text-xs text-neutral-400">
212-
{s.userAgent ?? 'unknown device'} · last seen {new Date(s.lastSeenAt).toLocaleString()}
214+
{s.userAgent ?? t('account.unknownDevice')} · {t('account.lastSeen', { date: new Date(s.lastSeenAt).toLocaleString() })}
213215
</p>
214216
</div>
215217
{!s.current && (
216218
<button className="btn-danger px-2 py-1" onClick={() => revoke(s.id)}>
217-
Revoke
219+
{t('account.revoke')}
218220
</button>
219221
)}
220222
</div>
@@ -224,17 +226,16 @@ export default function AccountPage() {
224226

225227
{/* Data & privacy (GDPR) */}
226228
<section className="card space-y-3">
227-
<h2 className="font-semibold">Your data</h2>
229+
<h2 className="font-semibold">{t('account.yourData')}</h2>
228230
<p className="text-sm text-neutral-500">
229-
Download a copy of your account data, or permanently delete your account and all of
230-
your files. Deletion cannot be undone.
231+
{t('account.dataHint')}
231232
</p>
232233
<div className="flex gap-2">
233234
<a className="btn-ghost" href={`${API_URL}/account/export`}>
234-
Export my data
235+
{t('account.exportData')}
235236
</a>
236237
<button className="btn-danger" onClick={deleteAccount}>
237-
Delete my account
238+
{t('account.deleteAccount')}
238239
</button>
239240
</div>
240241
</section>

‎apps/web/src/app/(app)/admin/UpdatePanel.tsx‎

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import { useCallback, useEffect, useRef, useState } from 'react';
1010
import { GitCommitHorizontal, RefreshCw, Download, CheckCircle2, AlertTriangle, Loader2 } from 'lucide-react';
1111
import { api, ApiError } from '@/lib/api';
12+
import { useT } from '@/lib/i18n';
1213
import { confirm, toast } from '@/components/ui/overlays';
1314

1415
interface LocalVersion {
@@ -45,6 +46,7 @@ interface VersionInfo {
4546
}
4647

4748
export function UpdatePanel() {
49+
const { t } = useT();
4850
const [info, setInfo] = useState<VersionInfo | null>(null);
4951
const [error, setError] = useState<string | null>(null);
5052
const [busy, setBusy] = useState<'check' | 'update' | null>(null);
@@ -96,17 +98,16 @@ export function UpdatePanel() {
9698

9799
async function runUpdate() {
98100
const ok = await confirm({
99-
title: 'Mettre à jour maintenant ?',
100-
message:
101-
'L’instance va récupérer la dernière version, se reconstruire et redémarrer. Une courte coupure est possible.',
102-
confirmLabel: 'Mettre à jour',
101+
title: t('admin.updateConfirmTitle'),
102+
message: t('admin.updateConfirmMsg'),
103+
confirmLabel: t('admin.updateConfirmBtn'),
103104
});
104105
if (!ok) return;
105106
setBusy('update');
106107
setError(null);
107108
try {
108109
await api.post('/admin/update');
109-
toast('Mise à jour lancée — redémarrage en cours…', 'info');
110+
toast(t('admin.updateStarted'), 'info');
110111
await fetchVersion(false);
111112
} catch (e) {
112113
setError(e instanceof ApiError ? e.message : String(e));
@@ -118,8 +119,8 @@ export function UpdatePanel() {
118119
if (!info) {
119120
return (
120121
<section className="card">
121-
<h2 className="font-semibold">Version &amp; mises à jour</h2>
122-
<p className="mt-2 text-sm text-zinc-500">Chargement…</p>
122+
<h2 className="font-semibold">{t('admin.versionUpdates')}</h2>
123+
<p className="mt-2 text-sm text-zinc-500">{t('common.loading')}</p>
123124
</section>
124125
);
125126
}
@@ -130,9 +131,9 @@ export function UpdatePanel() {
130131
return (
131132
<section className="card space-y-4">
132133
<div className="flex flex-wrap items-center justify-between gap-3">
133-
<h2 className="font-semibold">Version &amp; mises à jour</h2>
134+
<h2 className="font-semibold">{t('admin.versionUpdates')}</h2>
134135
<button className="btn-ghost" onClick={check} disabled={busy !== null || running}>
135-
<RefreshCw size={15} className={busy === 'check' ? 'animate-spin' : ''} /> Vérifier
136+
<RefreshCw size={15} className={busy === 'check' ? 'animate-spin' : ''} /> {t('admin.check')}
136137
</button>
137138
</div>
138139

@@ -145,7 +146,7 @@ export function UpdatePanel() {
145146
{current.isGit ? (
146147
<>
147148
<p className="text-sm text-zinc-200">
148-
Version actuelle{' '}
149+
{t('admin.currentVersionPre')}{' '}
149150
<code className="rounded bg-white/[0.06] px-1.5 py-0.5 font-mono text-xs text-zinc-100">
150151
{current.shortSha}
151152
</code>{' '}
@@ -158,7 +159,7 @@ export function UpdatePanel() {
158159
</>
159160
) : (
160161
<p className="text-sm text-zinc-400">
161-
Version inconnue — ce déploiement n’est pas un dépôt git, mettez à jour manuellement.
162+
{t('admin.versionUnknown')}
162163
</p>
163164
)}
164165
</div>
@@ -167,17 +168,17 @@ export function UpdatePanel() {
167168
{/* Update status while running / after */}
168169
{running && (
169170
<div className="flex items-center gap-2 rounded-lg border border-amber-500/20 bg-amber-500/[0.06] px-3 py-2 text-sm text-amber-200">
170-
<Loader2 size={15} className="animate-spin" /> {status.message ?? 'Mise à jour en cours…'}
171+
<Loader2 size={15} className="animate-spin" /> {status.message ?? t('admin.updateRunning')}
171172
</div>
172173
)}
173174
{!running && status.state === 'success' && (
174175
<div className="flex items-center gap-2 rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-3 py-2 text-sm text-emerald-200">
175-
<CheckCircle2 size={15} /> {status.message ?? 'Dernière mise à jour réussie.'}
176+
<CheckCircle2 size={15} /> {status.message ?? t('admin.updateSuccess')}
176177
</div>
177178
)}
178179
{!running && status.state === 'failed' && (
179180
<div className="flex items-center gap-2 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-sm text-red-300">
180-
<AlertTriangle size={15} /> Échec : {status.message ?? 'voir .update.log sur le serveur.'}
181+
<AlertTriangle size={15} /> {t('admin.updateFailedPre')} {status.message ?? t('admin.updateFailedDefault')}
181182
</div>
182183
)}
183184

@@ -186,37 +187,37 @@ export function UpdatePanel() {
186187
<div className="rounded-lg border border-white/[0.07] bg-white/[0.02] p-3">
187188
{remote == null ? (
188189
<p className="text-sm text-zinc-500">
189-
Impossible de joindre GitHub pour vérifier (limite de débit ou réseau). Réessayez plus tard.
190+
{t('admin.githubUnreachable')}
190191
</p>
191192
) : updateAvailable ? (
192193
<div className="space-y-2">
193194
<p className="text-sm text-zinc-200">
194-
Mise à jour disponible
195+
{t('admin.updateAvailable')}
195196
{typeof behindBy === 'number' && behindBy > 0 && (
196-
<span className="text-zinc-400"> — {behindBy} commit{behindBy > 1 ? 's' : ''} de retard</span>
197+
<span className="text-zinc-400">{behindBy > 1 ? t('admin.behindMany', { count: behindBy }) : t('admin.behindOne', { count: behindBy })}</span>
197198
)}
198199
</p>
199200
<p className="truncate text-xs text-zinc-500">
200-
Dernière :{' '}
201+
{t('admin.latest')}{' '}
201202
<a href={remote.htmlUrl} target="_blank" rel="noreferrer" className="font-mono text-violet-300 hover:underline">
202203
{remote.shortSha}
203204
</a>{' '}
204205
{remote.subject}
205206
</p>
206207
{selfUpdateEnabled ? (
207208
<button className="btn-primary" onClick={runUpdate} disabled={busy !== null || running}>
208-
<Download size={15} /> Mettre à jour maintenant
209+
<Download size={15} /> {t('admin.updateNow')}
209210
</button>
210211
) : (
211212
<p className="text-xs text-zinc-500">
212-
La mise à jour en un clic est désactivée (SELF_UPDATE_ENABLED=false). Lancez{' '}
213-
<code className="font-mono">./scripts/ocl.sh update</code> sur le serveur.
213+
{t('admin.selfUpdateDisabledPre')}{' '}
214+
<code className="font-mono">./scripts/ocl.sh update</code> {t('admin.selfUpdateDisabledPost')}
214215
</p>
215216
)}
216217
</div>
217218
) : (
218219
<p className="flex items-center gap-2 text-sm text-emerald-300">
219-
<CheckCircle2 size={15} /> Vous êtes à jour.
220+
<CheckCircle2 size={15} /> {t('admin.upToDate')}
220221
</p>
221222
)}
222223
</div>

0 commit comments

Comments
 (0)