fix(i18n): translate pricing tiers, features, and content pages
Some checks failed
Some checks failed
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user