Skip to main content

TenantTranslation

Tenant-specific translation overrides.

Allows tenants to customize translations to match their terminology,
industry, or brand voice. Overrides system translations when present.

Attributes:
tenant_id: Tenant identifier (from TenantContext)
source_text: Original text to translate (1-1000 characters)
translated_text: Translated text in target locale (1-1000 characters)
locale: Locale code (e.g., "en", "hi", "ta", "es_MX")
context: Optional context for disambiguation (e.g., "button", "field_label")

Constraints:
- Unique combination of (tenant_id, source_text, locale, context)
- locale must match pattern: 2 lowercase letters, optionally followed by
underscore and 2 uppercase letters (e.g., "en", "en_US", "pt_BR")

Example:
# Healthcare tenant uses "Patient" instead of "Customer"
TenantTranslation(
tenant_id="healthcare-corp",
source_text="Customer",
translated_text="Patient",
locale="en",
context="field_label"
)

# Retail tenant uses "Client" in French
TenantTranslation(
tenant_id="retail-corp",
source_text="Customer",
translated_text="Client",
locale="fr",
context="field_label"
)

Source: tenant_translation.py

Fields

FieldTypeRequiredDescriptionValidators
tenant_idstrTenant identifier from TenantContextminLen: 1, maxLen: 100
source_textstrOriginal text to translateminLen: 1, maxLen: 1000
translated_textstrTranslated text in target localeminLen: 1, maxLen: 1000
localestrLocale code (e.g., 'en', 'hi', 'ta', 'es_MX')minLen: 2, maxLen: 10, pattern: ^[a-z]{2}(_[A-Z]{2})?$
contextstrNoneOptional context for disambiguation (e.g., 'button', 'field_label')

Configuration

SettingValue
SubmittableFalse
Track ChangesTrue

Controller

Controller hooks are implemented in *_controller.py files. Available lifecycle hooks:

  • validate() - Called before save, raise exceptions for validation errors
  • before_insert() - Called before inserting a new document
  • after_insert() - Called after successfully inserting
  • before_save() - Called before saving (insert or update)
  • after_save() - Called after saving
  • before_delete() - Called before deleting
  • after_delete() - Called after deleting