Add catalog EN/AR translations with AI translate-all by locale.
Store product/category translations in entity_translations, expose CMS APIs, and gate the MultiLanguage Data module for businesses. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
42cf29bc4e
commit
d14f91a606
@@ -106,6 +106,7 @@ model Business {
|
||||
comments Comment[]
|
||||
contactSubmissions ContactSubmission[]
|
||||
domains Domain[]
|
||||
entityTranslations EntityTranslation[]
|
||||
expertReviews ExpertReview[]
|
||||
favorites Favorite[]
|
||||
invoiceItemTemplates InvoiceItemTemplate[]
|
||||
@@ -1738,3 +1739,46 @@ model WebsitePageViewCounter {
|
||||
@@index([businessId, pageKind], map: "idx_website_page_view_counters_business_kind")
|
||||
@@map("website_page_view_counters")
|
||||
}
|
||||
|
||||
model EntityTranslation {
|
||||
id BigInt @id @default(autoincrement())
|
||||
businessId BigInt @map("business_id")
|
||||
entityType TranslationEntityType @map("entity_type")
|
||||
entityId BigInt @map("entity_id")
|
||||
locale TranslationLocale
|
||||
fields Json @default("{}")
|
||||
sourceHash String @map("source_hash") @db.VarChar(64)
|
||||
status TranslationStatus @default(pending)
|
||||
generatedBy String @default("ai") @map("generated_by") @db.VarChar(16)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||
business Business @relation(fields: [businessId], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
||||
|
||||
@@unique([entityType, entityId, locale], map: "entity_translations_entity_locale_unique")
|
||||
@@index([businessId], map: "idx_entity_translations_business_id")
|
||||
@@index([entityType, entityId], map: "idx_entity_translations_entity")
|
||||
@@map("entity_translations")
|
||||
}
|
||||
|
||||
enum TranslationEntityType {
|
||||
product
|
||||
category
|
||||
|
||||
@@map("translation_entity_type")
|
||||
}
|
||||
|
||||
enum TranslationLocale {
|
||||
en
|
||||
ar
|
||||
|
||||
@@map("translation_locale")
|
||||
}
|
||||
|
||||
enum TranslationStatus {
|
||||
pending
|
||||
ready
|
||||
stale
|
||||
failed
|
||||
|
||||
@@map("translation_status")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user