feat: add i18n support with VITE_LOCALE env var (en/fr)

- Lightweight i18n system in src/lib/i18n.ts (no external deps)
- All UI strings extracted to translation keys
- English (default) and French locales included
- Set VITE_LOCALE=fr in .env for French UI
- Fallback to English for unknown locales
This commit is contained in:
Nicolas Varrot
2026-02-11 13:19:20 +00:00
parent 8132ddb59f
commit 99b7db9793
9 changed files with 134 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
import { MessageSquare, X, Sparkles } from 'lucide-react';
import type { Session } from '../types';
import { t } from '../lib/i18n';
interface Props {
sessions: Session[];
@@ -22,7 +23,7 @@ export function Sidebar({ sessions, activeSession, onSwitch, open, onClose }: Pr
<Sparkles className="h-4 w-4 text-cyan-200" />
</div>
</div>
<span className="font-semibold text-sm text-zinc-200 tracking-wide">Sessions</span>
<span className="font-semibold text-sm text-zinc-200 tracking-wide">{t('sidebar.title')}</span>
</div>
<button onClick={onClose} className="lg:hidden p-1.5 rounded-xl hover:bg-white/5 text-zinc-400 transition-colors">
<X size={16} />
@@ -30,7 +31,7 @@ export function Sidebar({ sessions, activeSession, onSwitch, open, onClose }: Pr
</div>
<div className="flex-1 overflow-y-auto py-2 px-2">
{sessions.length === 0 && (
<div className="px-3 py-8 text-center text-zinc-500 text-sm">No sessions</div>
<div className="px-3 py-8 text-center text-zinc-500 text-sm">{t('sidebar.empty')}</div>
)}
{sessions.map(s => {
const isActive = s.key === activeSession;