i18n: fix missing keys and translate all non-admin frontend strings
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m43s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m43s
- Add 12 missing i18n keys (t() was returning the literal key string) to
all 13 locales: dashboard.topbar.premiumAccess,
dashboard.translate.complete.toastOkDesc,
dashboard.translate.progress.{connectionLost,processingFallback},
glossaries.card.{term,created}, glossaries.termEditor.{addTerm,maxReached},
login.google.{connecting,errorFailed,errorGeneric}, login.orContinueWith
- Add 6 FR-drift keys (landing.pricing.{free,enterprise}.{name,desc,cta})
- Add ~120 new i18n keys covering site header/footer, file-uploader,
checkout success, dashboard pages, translate page, provider selector
themes, language selector, translation complete, api-keys, services,
settings, pricing (~1800 new key/locale pairs)
- Wrap hardcoded French/English in components with t() calls
- Convert LLM_THEMES/CLASSIC_THEMES/FALLBACK_PROVIDERS maps from
hardcoded constants to t()-driven factories
- Admin pages intentionally left untouched per request
Files: 15 components/pages + src/lib/i18n.tsx
Typecheck: passes (tsc --noEmit exit 0)
This commit is contained in:
@@ -5,6 +5,7 @@ import { useSearchParams, useRouter } from 'next/navigation';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { API_BASE } from '@/lib/config';
|
||||
import { CheckCircle2, XCircle, RefreshCw } from 'lucide-react';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
|
||||
/**
|
||||
* /checkout/success
|
||||
@@ -17,6 +18,7 @@ export default function CheckoutSuccessPage() {
|
||||
const router = useRouter();
|
||||
const sessionId = searchParams.get('session_id');
|
||||
const queryClient = useQueryClient();
|
||||
const { t } = useI18n();
|
||||
|
||||
const [status, setStatus] = useState<'syncing' | 'ok' | 'error'>('syncing');
|
||||
const [message, setMessage] = useState('');
|
||||
@@ -43,19 +45,23 @@ export default function CheckoutSuccessPage() {
|
||||
try { data = await res.json(); } catch { /* ignore */ }
|
||||
if (res.ok) {
|
||||
setStatus('ok');
|
||||
setMessage(data.data?.plan ? `Forfait ${data.data.plan} activé !` : 'Abonnement activé !');
|
||||
setMessage(
|
||||
data.data?.plan
|
||||
? t('checkout.planActivated', { plan: data.data.plan })
|
||||
: t('checkout.subscriptionActivated')
|
||||
);
|
||||
queryClient.invalidateQueries({ queryKey: ['user', 'me'] });
|
||||
// Redirect after 2s
|
||||
setTimeout(() => router.replace('/dashboard/profile?tab=subscription'), 2000);
|
||||
} else {
|
||||
setStatus('error');
|
||||
setMessage(data.message ?? data.error ?? 'Erreur de synchronisation');
|
||||
setMessage(data.message ?? data.error ?? t('checkout.syncError'));
|
||||
setTimeout(() => router.replace('/dashboard/profile?tab=subscription'), 3000);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
setStatus('error');
|
||||
setMessage('Erreur réseau. Votre paiement est confirmé — rechargez votre profil.');
|
||||
setMessage(t('checkout.networkError'));
|
||||
setTimeout(() => router.replace('/dashboard/profile?tab=subscription'), 3000);
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -67,24 +73,24 @@ export default function CheckoutSuccessPage() {
|
||||
{status === 'syncing' && (
|
||||
<>
|
||||
<RefreshCw className="w-12 h-12 text-brand-accent animate-spin" />
|
||||
<h1 className="text-2xl font-black uppercase tracking-tight">Activation en cours…</h1>
|
||||
<p className="text-sm text-muted-foreground">Nous mettons à jour votre abonnement, veuillez patienter.</p>
|
||||
<h1 className="text-2xl font-black uppercase tracking-tight">{t('checkout.activating')}</h1>
|
||||
<p className="text-sm text-muted-foreground">{t('checkout.activatingDesc')}</p>
|
||||
</>
|
||||
)}
|
||||
{status === 'ok' && (
|
||||
<>
|
||||
<CheckCircle2 className="w-12 h-12 text-emerald-500" />
|
||||
<h1 className="text-2xl font-black uppercase tracking-tight text-emerald-600">Paiement confirmé !</h1>
|
||||
<h1 className="text-2xl font-black uppercase tracking-tight text-emerald-600">{t('checkout.paymentConfirmed')}</h1>
|
||||
<p className="text-sm text-muted-foreground">{message}</p>
|
||||
<p className="text-xs text-muted-foreground">Redirection vers votre profil…</p>
|
||||
<p className="text-xs text-muted-foreground">{t('checkout.redirectingToProfile')}</p>
|
||||
</>
|
||||
)}
|
||||
{status === 'error' && (
|
||||
<>
|
||||
<XCircle className="w-12 h-12 text-amber-500" />
|
||||
<h1 className="text-2xl font-black uppercase tracking-tight">Paiement reçu</h1>
|
||||
<h1 className="text-2xl font-black uppercase tracking-tight">{t('checkout.paymentReceived')}</h1>
|
||||
<p className="text-sm text-muted-foreground">{message}</p>
|
||||
<p className="text-xs text-muted-foreground">Redirection…</p>
|
||||
<p className="text-xs text-muted-foreground">{t('checkout.redirecting')}</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user