feat: Complete internationalization and code cleanup

## Translation Files
- Add 11 new language files (es, de, pt, ru, zh, ja, ko, ar, hi, nl, pl)
- Add 100+ missing translation keys across all 15 languages
- New sections: notebook, pagination, ai.batchOrganization, ai.autoLabels
- Update nav section with workspace, quickAccess, myLibrary keys

## Component Updates
- Update 15+ components to use translation keys instead of hardcoded text
- Components: notebook dialogs, sidebar, header, note-input, ghost-tags, etc.
- Replace 80+ hardcoded English/French strings with t() calls
- Ensure consistent UI across all supported languages

## Code Quality
- Remove 77+ console.log statements from codebase
- Clean up API routes, components, hooks, and services
- Keep only essential error handling (no debugging logs)

## UI/UX Improvements
- Update Keep logo to yellow post-it style (from-yellow-400 to-amber-500)
- Change selection colors to #FEF3C6 (notebooks) and #EFB162 (nav items)
- Make "+" button permanently visible in notebooks section
- Fix grammar and syntax errors in multiple components

## Bug Fixes
- Fix JSON syntax errors in it.json, nl.json, pl.json, zh.json
- Fix syntax errors in notebook-suggestion-toast.tsx
- Fix syntax errors in use-auto-tagging.ts
- Fix syntax errors in paragraph-refactor.service.ts
- Fix duplicate "fusion" section in nl.json

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Ou une version plus courte si vous préférez :

feat(i18n): Add 15 languages, remove logs, update UI components

- Create 11 new translation files (es, de, pt, ru, zh, ja, ko, ar, hi, nl, pl)
- Add 100+ translation keys: notebook, pagination, AI features
- Update 15+ components to use translations (80+ strings)
- Remove 77+ console.log statements from codebase
- Fix JSON syntax errors in 4 translation files
- Fix component syntax errors (toast, hooks, services)
- Update logo to yellow post-it style
- Change selection colors (#FEF3C6, #EFB162)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-11 22:26:13 +01:00
parent fc2c40249e
commit 7fb486c9a4
183 changed files with 48288 additions and 1290 deletions

View File

@@ -13,22 +13,26 @@ import {
DialogTrigger,
} from './ui/dialog'
import { Badge } from './ui/badge'
import { Tag, X, Plus, Palette } from 'lucide-react'
import { Tag, X, Plus, Palette, AlertCircle } from 'lucide-react'
import { LABEL_COLORS, LabelColorName } from '@/lib/types'
import { cn } from '@/lib/utils'
import { useLabels, Label } from '@/context/LabelContext'
import { useLanguage } from '@/lib/i18n'
interface LabelManagerProps {
existingLabels: string[]
notebookId?: string | null
onUpdate: (labels: string[]) => void
}
export function LabelManager({ existingLabels, onUpdate }: LabelManagerProps) {
export function LabelManager({ existingLabels, notebookId, onUpdate }: LabelManagerProps) {
const { labels, loading, addLabel, updateLabel, deleteLabel, getLabelColor } = useLabels()
const { t } = useLanguage()
const [open, setOpen] = useState(false)
const [newLabel, setNewLabel] = useState('')
const [selectedLabels, setSelectedLabels] = useState<string[]>(existingLabels)
const [editingColor, setEditingColor] = useState<string | null>(null)
const [errorMessage, setErrorMessage] = useState<string | null>(null)
// Sync selected labels with existingLabels prop
useEffect(() => {
@@ -37,18 +41,29 @@ export function LabelManager({ existingLabels, onUpdate }: LabelManagerProps) {
const handleAddLabel = async () => {
const trimmed = newLabel.trim()
setErrorMessage(null) // Clear previous error
if (trimmed && !selectedLabels.includes(trimmed)) {
try {
// NotebookId is REQUIRED for label creation (PRD R2)
if (!notebookId) {
setErrorMessage(t('labels.notebookRequired'))
console.error(t('labels.notebookRequired'))
return
}
// Get existing label color or use random
const existingLabel = labels.find(l => l.name === trimmed)
const color = existingLabel?.color || (Object.keys(LABEL_COLORS) as LabelColorName[])[Math.floor(Math.random() * Object.keys(LABEL_COLORS).length)]
await addLabel(trimmed, color)
await addLabel(trimmed, color, notebookId)
const updated = [...selectedLabels, trimmed]
setSelectedLabels(updated)
setNewLabel('')
} catch (error) {
console.error('Failed to add label:', error)
const errorMsg = error instanceof Error ? error.message : 'Failed to add label'
setErrorMessage(errorMsg)
}
}
}
@@ -99,7 +114,7 @@ export function LabelManager({ existingLabels, onUpdate }: LabelManagerProps) {
<DialogTrigger asChild>
<Button variant="ghost" size="sm">
<Tag className="h-4 w-4 mr-2" />
Labels
{t('labels.title')}
</Button>
</DialogTrigger>
<DialogContent
@@ -129,19 +144,30 @@ export function LabelManager({ existingLabels, onUpdate }: LabelManagerProps) {
}}
>
<DialogHeader>
<DialogTitle>Manage Labels</DialogTitle>
<DialogTitle>{t('labels.manageLabels')}</DialogTitle>
<DialogDescription>
Add or remove labels for this note. Click on a label to change its color.
{t('labels.manageLabelsDescription')}
</DialogDescription>
</DialogHeader>
<div className="space-y-4 py-4">
{/* Error message */}
{errorMessage && (
<div className="flex items-start gap-2 p-3 bg-amber-50 dark:bg-amber-950/20 rounded-lg border border-amber-200 dark:border-amber-900">
<AlertCircle className="h-4 w-4 text-amber-600 dark:text-amber-500 mt-0.5 flex-shrink-0" />
<p className="text-sm text-amber-800 dark:text-amber-200">{errorMessage}</p>
</div>
)}
{/* Add new label */}
<div className="flex gap-2">
<Input
placeholder="New label name"
placeholder={t('labels.newLabelPlaceholder')}
value={newLabel}
onChange={(e) => setNewLabel(e.target.value)}
onChange={(e) => {
setNewLabel(e.target.value)
setErrorMessage(null) // Clear error when typing
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.preventDefault()
@@ -157,7 +183,7 @@ export function LabelManager({ existingLabels, onUpdate }: LabelManagerProps) {
{/* Selected labels */}
{selectedLabels.length > 0 && (
<div>
<h4 className="text-sm font-medium mb-2">Selected Labels</h4>
<h4 className="text-sm font-medium mb-2">{t('labels.selectedLabels')}</h4>
<div className="flex flex-wrap gap-2">
{selectedLabels.map((label) => {
const labelObj = labels.find(l => l.name === label)
@@ -218,7 +244,7 @@ export function LabelManager({ existingLabels, onUpdate }: LabelManagerProps) {
{/* Available labels from context */}
{!loading && labels.length > 0 && (
<div>
<h4 className="text-sm font-medium mb-2">All Labels</h4>
<h4 className="text-sm font-medium mb-2">{t('labels.allLabels')}</h4>
<div className="flex flex-wrap gap-2">
{labels
.filter(label => !selectedLabels.includes(label.name))
@@ -248,9 +274,9 @@ export function LabelManager({ existingLabels, onUpdate }: LabelManagerProps) {
<DialogFooter>
<Button variant="outline" onClick={handleCancel}>
Cancel
{t('general.cancel')}
</Button>
<Button onClick={handleSave}>Save</Button>
<Button onClick={handleSave}>{t('general.save')}</Button>
</DialogFooter>
</DialogContent>
</Dialog>