Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 116 additions & 2 deletions apps/web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
"axios": "^1.16.0",
"clsx": "^2.1.1",
"dompurify": "^3.2.7",
"i18next": "^24.2.3",
"lucide-react": "^0.563.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-i18next": "^15.7.4",
"react-router-dom": "^7.13.0",
"recharts": "^3.7.0",
"tailwind-merge": "^3.4.0",
Expand Down
34 changes: 34 additions & 0 deletions apps/web/src/components/LanguageSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { useTranslation } from 'react-i18next';
import { SUPPORTED_LANGUAGES, setLanguage, type LanguageCode } from '../i18n';
import { cn } from '../lib/utils';

interface LanguageSwitcherProps {
className?: string;
}

/**
* Compact UI-language selector (issue #32). Persists the choice to localStorage
* via setLanguage so it survives reloads and applies app-wide immediately.
*/
export function LanguageSwitcher({ className }: LanguageSwitcherProps) {
const { t, i18n } = useTranslation('common');
const current = i18n.resolvedLanguage ?? i18n.language;

return (
<label className={cn('inline-flex items-center gap-2 text-sm', className)}>
<span className="text-(--txt-tertiary)">{t('language')}</span>
<select
aria-label={t('language')}
value={current}
onChange={(e) => setLanguage(e.target.value as LanguageCode)}
className="rounded-(--radius-md) border border-(--border-subtle) bg-(--bg-surface-1) px-2 py-1 text-sm text-(--txt-primary) focus:outline-none focus:border-(--border-strong)"
>
{SUPPORTED_LANGUAGES.map((l) => (
<option key={l.code} value={l.code}>
{l.label}
</option>
))}
</select>
</label>
);
}
Loading
Loading