fix(i18n): translate pricing tiers, features, and content pages
Some checks failed
CI / ruff (push) Successful in 11s
CI / pytest (push) Failing after 49m22s
CI / validate (push) Successful in 26s
CI / dependency-scanning (push) Successful in 28s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped

Add name_translations JSON column to SubscriptionTier for multi-language
tier names. Pre-resolve tier names and build dynamic feature lists from
module providers in route handlers. Fix Jinja2 macro scoping by importing
pricing partial with context. Backfill content_translations for all 43
content pages across 4 platforms (en/fr/de/lb).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 07:48:15 +01:00
parent 8b147f53c6
commit 3c7e4458af
9 changed files with 1544 additions and 33 deletions

View File

@@ -100,6 +100,12 @@ class SubscriptionTier(Base, TimestampMixin):
code = Column(String(30), nullable=False, index=True)
name = Column(String(100), nullable=False)
name_translations = Column(
JSON,
nullable=True,
default=None,
comment="Language-keyed name dict for multi-language support",
)
description = Column(Text, nullable=True)
# Pricing (in cents for precision)
@@ -154,6 +160,16 @@ class SubscriptionTier(Base, TimestampMixin):
"""Check if this tier includes a specific feature."""
return feature_code in self.get_feature_codes()
def get_translated_name(self, lang: str, default_lang: str = "fr") -> str:
"""Get name in the given language, falling back to default_lang then self.name."""
if self.name_translations:
return (
self.name_translations.get(lang)
or self.name_translations.get(default_lang)
or self.name
)
return self.name
# ============================================================================
# AddOnProduct - Purchasable add-ons