feat: prevent duplicate glossary presets + fix i18n source warning bug
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m5s

- Add template_id column to Glossary model (nullable, indexed)
- Backend: return 409 Conflict if user already imported a template
- Frontend: disable preset cards already imported, show 'Imported' badge
- Fix duplicated text in GlossarySelector source warning (hardcoded FR text removed)
- Complete i18n migration for glossaries page and GlossarySelector
- Add glossaries.presets.alreadyImported key in all 13 locales
This commit is contained in:
2026-06-01 23:39:53 +02:00
parent ce53f0df16
commit 818eac5490
6 changed files with 61 additions and 8 deletions

View File

@@ -334,6 +334,7 @@ class Glossary(Base):
name = Column(String(255), nullable=False)
source_language = Column(String(10), nullable=False, default="fr")
target_language = Column(String(10), nullable=True, default="en")
template_id = Column(String(50), nullable=True, index=True)
created_at = Column(DateTime, default=_utcnow)
updated_at = Column(DateTime, default=_utcnow, onupdate=_utcnow)
@@ -343,7 +344,10 @@ class Glossary(Base):
)
# Indexes
__table_args__ = (Index("ix_glossaries_user_id", "user_id"),)
__table_args__ = (
Index("ix_glossaries_user_id", "user_id"),
Index("ix_glossaries_template_id", "template_id"),
)
def to_dict(self) -> dict:
return {
@@ -352,6 +356,7 @@ class Glossary(Base):
"name": self.name,
"source_language": self.source_language,
"target_language": self.target_language,
"template_id": self.template_id,
"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,