Files
karaoke-gen/frontend/components/lyrics-review/EditActionBar.tsx
T
Andrew Beveridge ☄️andClaude Opus 4.6 8c1dfe5460 feat(i18n): Phase 3 frontend — next-intl infrastructure + 1062 strings (en/es/de) (#656)
@coderabbitai ignore

## Summary
- Phase 3 of the i18n multilingual initiative — makes the karaoke-gen
frontend fully multilingual (English, Spanish, German)
- Installs `next-intl` with `[locale]` path-based routing,
LanguageSwitcher, and `Accept-Language` API header
- Extracts **1,062 strings** from ~70 components into `messages/en.json`
across 31 namespaces
- Wires `useTranslations()` into all user-facing components (landing,
dashboard, auth, job flow, lyrics review, instrumental review, audio
editor, etc.)
- Admin pages (`/admin/*`) stay outside locale routing — intentionally
excluded from i18n scope
- Static export generates `/en/`, `/es/`, `/de/` directories (45 total
pages) for Cloudflare Pages
- `es.json`/`de.json` are English placeholders — translation via Gemini
pipeline pending
- Translation pipeline (`scripts/translate.py`) and glossary (55
karaoke-specific terms) included

## Key architecture decisions
- Root layout keeps ThemeProvider/TenantProvider (needed by admin pages
outside `[locale]`)
- Only NextIntlClientProvider added to `[locale]/layout.tsx`
- `job-status.ts` labels converted to translation keys; consumers
translate via `useTranslations('jobStatus')`
- Jest mock loads actual `en.json` so existing tests validate i18n
wiring without assertion changes

## Test plan
- [x] All 707 frontend tests pass (39 suites)
- [x] Static build generates all 45 pages across 3 locales
- [x] Admin pages render at `/admin/` without locale prefix
- [x] CodeRabbit review: 4 issues fixed, 7 pre-existing noted
- [ ] Post-deploy: verify `/en/` landing page renders correctly
- [ ] Post-deploy: verify LanguageSwitcher redirects to `/es/` and
`/de/`
- [ ] Post-deploy: verify `/admin/` still works without locale context

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 21:50:53 -04:00

85 lines
2.4 KiB
TypeScript

'use client'
import { useTranslations } from 'next-intl'
import { Button } from '@/components/ui/button'
import { Trash2, RotateCcw, History } from 'lucide-react'
import { LyricsSegment } from '@/lib/lyrics-review/types'
import { cn } from '@/lib/utils'
interface EditActionBarProps {
onReset: () => void
onRevertToOriginal?: () => void
onDelete?: () => void
onClose: () => void
onSave: () => void
editedSegment: LyricsSegment | null
originalTranscribedSegment?: LyricsSegment | null
isGlobal?: boolean
}
export default function EditActionBar({
onReset,
onRevertToOriginal,
onDelete,
onClose,
onSave,
editedSegment,
originalTranscribedSegment,
isGlobal = false,
}: EditActionBarProps) {
const t = useTranslations('lyricsReview.editActionBar')
const isMobile = typeof window !== 'undefined' && window.innerWidth < 640
return (
<div
className={cn(
'flex w-full gap-2',
isMobile ? 'flex-col items-stretch' : 'flex-row items-center'
)}
>
<div
className={cn(
'flex items-center gap-2 flex-wrap',
isMobile ? 'justify-center' : 'justify-start'
)}
>
<Button variant="outline" size={isMobile ? 'sm' : 'default'} onClick={onReset}>
<RotateCcw className="h-4 w-4 mr-1" />
{t('reset')}
</Button>
{originalTranscribedSegment && (
<Button variant="outline" size={isMobile ? 'sm' : 'default'} onClick={onRevertToOriginal}>
<History className="h-4 w-4 mr-1" />
{t('unCorrect')}
</Button>
)}
{!isGlobal && onDelete && (
<Button
variant="outline"
size={isMobile ? 'sm' : 'default'}
onClick={onDelete}
className="text-destructive hover:text-destructive"
>
<Trash2 className="h-4 w-4 mr-1" />
{t('deleteSegment')}
</Button>
)}
</div>
<div
className={cn('flex gap-2', isMobile ? 'justify-center ml-0' : 'justify-end ml-auto')}
>
<Button variant="outline" size={isMobile ? 'sm' : 'default'} onClick={onClose}>
{t('cancel')}
</Button>
<Button
size={isMobile ? 'sm' : 'default'}
onClick={onSave}
disabled={!editedSegment || editedSegment.words.length === 0}
>
{t('save')}
</Button>
</div>
</div>
)
}