feat: add multilingual glossary support (backend + frontend types)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m31s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m31s
Backend: - Add source_language column to glossaries table - Add translations JSON column to glossary_terms table - Alembic migration for schema changes - format_glossary_for_prompt now language-aware: extracts correct translation per target language, falls back to EN reference for templates with only FR→EN data - CRUD routes accept/return source_language and translations - Pydantic schemas updated Frontend: - Types updated: GlossaryTerm now has translations: Record<string, string> - Glossary/GlossaryListItem now have source_language - Added SUPPORTED_LANGUAGES constant (13 languages) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -330,6 +330,7 @@ class Glossary(Base):
|
||||
String(36), ForeignKey("users.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
name = Column(String(255), nullable=False)
|
||||
source_language = Column(String(10), nullable=False, default="fr")
|
||||
created_at = Column(DateTime, default=_utcnow)
|
||||
updated_at = Column(DateTime, default=_utcnow, onupdate=_utcnow)
|
||||
|
||||
@@ -346,6 +347,7 @@ class Glossary(Base):
|
||||
"id": self.id,
|
||||
"user_id": self.user_id,
|
||||
"name": self.name,
|
||||
"source_language": self.source_language,
|
||||
"terms": [term.to_dict() for term in self.terms] if self.terms else [],
|
||||
"created_at": self.created_at.isoformat() if self.created_at else None,
|
||||
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
|
||||
@@ -365,6 +367,7 @@ class GlossaryTerm(Base):
|
||||
)
|
||||
source = Column(String(500), nullable=False)
|
||||
target = Column(String(500), nullable=False)
|
||||
translations = Column(JSON, nullable=True, default=dict)
|
||||
created_at = Column(DateTime, default=_utcnow)
|
||||
|
||||
# Relationship
|
||||
@@ -378,6 +381,7 @@ class GlossaryTerm(Base):
|
||||
"id": self.id,
|
||||
"source": self.source,
|
||||
"target": self.target,
|
||||
"translations": self.translations or {},
|
||||
"created_at": self.created_at.isoformat() if self.created_at else None,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user