perf+security: fix build, secure downloads, dedupe translations, refactor i18n
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m49s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m49s
Frontend:
- Fix Framer Motion / motion-dom build error by pinning framer-motion to
11.18.2 (compatible with React 19 and Next.js 16).
- Add cross-env and build:local script to bypass standalone symlink errors
on Windows without Developer Mode.
- Allow NEXT_OUTPUT=default to disable standalone output for local builds.
- Refactor i18n: split 14,177-line src/lib/i18n.tsx into per-locale,
per-namespace JSON files under src/lib/i18n/messages/.
- Load English synchronously; other locales loaded on demand via dynamic
imports (reduces initial bundle, improves maintainability).
- Remove unused next-intl message files src/messages/en.json and fr.json.
Backend:
- Remove insecure legacy /api/v1/download/{filename} and /api/v1/cleanup/{filename}
endpoints. The job-based /api/v1/download/{job_id} already enforces ownership.
- Deduplicate texts in TranslationService.translate_batch before sending them
to the provider, reducing API calls for repeated strings.
- Pin httpx to <0.28 to fix TestClient incompatibility with starlette 0.35.1.
- Add pytest-cov and ruff dev dependencies/config.
DevOps:
- Remove hardcoded Grafana password from docker-compose.yml and
docker-compose.monitoring.yml; use GRAFANA_PASSWORD env var.
- Change default TRANSLATION_SERVICE from ollama to google in
docker-compose.yml (Ollama is an optional profile).
- Add GRAFANA_PASSWORD to .env.example.
- Add .coverage and frontend/pnpm-workspace.yaml to .gitignore.
Tests:
- Update API versioning tests for removed legacy endpoints.
- Add tests/test_translation_service.py for deduplication behavior.
Verified:
- pnpm run build:local passes.
- uv run pytest tests/test_providers/* tests/test_translation_service.py
tests/test_story_3_5_api_versioning.py tests/test_download_endpoint.py
tests/test_translators/test_excel_translator.py: provider/translator tests
pass; one pre-existing French error-message test still fails (message is
returned in English, unrelated to this change).
This commit is contained in:
93
frontend/src/lib/i18n/messages/en/translate.json
Normal file
93
frontend/src/lib/i18n/messages/en/translate.json
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"translate.glossary.selectGlossary": "Select a glossary...",
|
||||
"translate.mode.label": "Translation Mode",
|
||||
"translate.mode.classic": "Classic",
|
||||
"translate.mode.classicDesc": "Fast",
|
||||
"translate.mode.proLlm": "Pro LLM",
|
||||
"translate.mode.proLlmDesc": "Context-Aware",
|
||||
"translate.mode.tooltip": "Upgrade to Pro for LLM translation",
|
||||
"translate.mode.upgradeLink": "Upgrade to Pro",
|
||||
"translate.mode.upgradeDesc": "for LLM-powered translations",
|
||||
"translate.glossary.title": "Glossary",
|
||||
"translate.glossary.select": "Select a glossary",
|
||||
"translate.glossary.none": "None",
|
||||
"translate.glossary.terms": "terms",
|
||||
"translate.glossary.proOnly": "Upgrade to Pro to use glossaries",
|
||||
"translate.glossary.myGlossaries": "My glossaries",
|
||||
"translate.glossary.fromTemplate": "Create from template",
|
||||
"translate.glossary.noGlossaryForPair": "No glossary for",
|
||||
"translate.glossary.noGlossaries": "No glossaries yet",
|
||||
"translate.glossary.loading": "Loading...",
|
||||
"translate.glossary.classicMode": "Neutral engine without glossary (AI only)",
|
||||
"translate.glossary.selectPlaceholder": "Select a glossary...",
|
||||
"translate.glossary.multilingual": "MULTILINGUAL",
|
||||
"translate.glossary.noGlossaryAvailable": "No glossary available",
|
||||
"translate.glossary.filterByLang": "Filter by language",
|
||||
"translate.glossary.active": "Active",
|
||||
"translate.glossary.inactive": "Inactive",
|
||||
"translate.glossary.availableTemplates": "Available templates",
|
||||
"translate.glossary.importing": "Importing...",
|
||||
"translate.glossary.imported": "(Imported)",
|
||||
"translate.glossary.noGlossaryForSource": "No glossary or template for source language",
|
||||
"translate.glossary.createGlossary": "Create a glossary",
|
||||
"translate.glossary.showAll": "Show all glossaries",
|
||||
"translate.glossary.activePreview": "Active matches preview:",
|
||||
"translate.glossary.total": "total",
|
||||
"translate.glossary.moreTerms": "more terms",
|
||||
"translate.glossary.noTerms": "No terms in this glossary.",
|
||||
"translate.glossary.sourceTerm": "Source term",
|
||||
"translate.glossary.translation": "Translation",
|
||||
"translate.glossary.addTerm": "Add term",
|
||||
"translate.glossary.disabledMode": "Neutral engine without glossary applied",
|
||||
"translate.glossary.addTermError": "Error adding term",
|
||||
"translate.glossary.networkError": "Network error",
|
||||
"translate.glossary.importFailed": "Import failed ({status})",
|
||||
"translate.glossary.helpText": "The glossary forces precise term translation. Choose a glossary whose source language matches your document's original language.",
|
||||
"translate.glossary.sourceWarning": "Warning: This glossary uses source language",
|
||||
"translate.glossary.sourceWarningBut": "but your document is configured in",
|
||||
"translate.glossary.targetWarning": "Target mismatch: This glossary is designed to translate to",
|
||||
"translate.glossary.targetWarningBut": "but your document targets",
|
||||
"translate.glossary.targetWarningEnd": "Terms may not be relevant.",
|
||||
"translate.header.processing": "Processing in progress",
|
||||
"translate.header.aiActive": "AI analysis active",
|
||||
"translate.header.aiActiveDesc": "Your layout is being preserved by our contextual engine.",
|
||||
"translate.header.completed": "Completed",
|
||||
"translate.header.completedTitle": "Translation completed",
|
||||
"translate.header.proSpace": "Pro space",
|
||||
"translate.header.translateDoc": "Translate a document",
|
||||
"translate.header.translateDocDesc": "Preserve the original layout with our ultra-high-fidelity translation engine.",
|
||||
"translate.upload.nativeFormat": "Native format",
|
||||
"translate.fileType.word": "Word (.docx)",
|
||||
"translate.fileType.excel": "Excel (.xlsx)",
|
||||
"translate.fileType.slides": "Slides (.pptx)",
|
||||
"translate.fileType.pdf": "PDF (.pdf)",
|
||||
"translate.startTranslation": "Start translation",
|
||||
"translate.submit": "Submitting...",
|
||||
"translate.chooseTargetLang": "Please choose a target language",
|
||||
"translate.pleaseLoadFile": "Please upload a file first",
|
||||
"translate.contextEngineActive": "Contextual engine active",
|
||||
"translate.phase1": "Phase 1: Initialisation",
|
||||
"translate.phase2": "Phase 2: Contextual reconstruction",
|
||||
"translate.stat.segments": "segments",
|
||||
"translate.stat.precision": "precision",
|
||||
"translate.stat.speedLabel": "speed",
|
||||
"translate.stat.turbo": "Turbo",
|
||||
"translate.stat.time": "time",
|
||||
"translate.complete.masterQuality": "✓ Master quality",
|
||||
"translate.download": "Download",
|
||||
"translate.newTranslation": "+ New translation",
|
||||
"translate.failedTitle": "Translation error",
|
||||
"translate.retry": "Retry",
|
||||
"translate.uploadAnother": "Upload another file",
|
||||
"translate.monitor": "AI monitor",
|
||||
"translate.summary": "Summary",
|
||||
"translate.cancelProcess": "⟳ Cancel the process",
|
||||
"translate.layoutIntegrity": "Layout integrity",
|
||||
"translate.secureHundred": "100% SECURE",
|
||||
"translate.okHundred": "100% OK",
|
||||
"translate.preserveLayout": "Preserve layout",
|
||||
"translate.preserveLayoutDesc": "Preserve the layout",
|
||||
"translate.textOnly": "Text only",
|
||||
"translate.textOnlyDesc": "Fast translation of text only",
|
||||
"translate.unavailableStandard": "Unavailable in Standard mode (AI only)"
|
||||
}
|
||||
Reference in New Issue
Block a user