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:
@@ -34,6 +34,9 @@ def _get_platform_context(request: Any, db: Any, platform: Any) -> dict[str, Any
|
||||
"""
|
||||
from app.core.config import settings
|
||||
from app.modules.billing.models import SubscriptionTier, TierCode
|
||||
from app.modules.billing.services.feature_aggregator import feature_aggregator
|
||||
|
||||
language = getattr(request.state, "language", "fr") or "fr"
|
||||
|
||||
tiers_db = (
|
||||
db.query(SubscriptionTier)
|
||||
@@ -48,14 +51,28 @@ def _get_platform_context(request: Any, db: Any, platform: Any) -> dict[str, Any
|
||||
tiers = []
|
||||
for tier in tiers_db:
|
||||
feature_codes = sorted(tier.get_feature_codes())
|
||||
|
||||
# Build features list from declarations for template rendering
|
||||
features = []
|
||||
for code in feature_codes:
|
||||
decl = feature_aggregator.get_declaration(code)
|
||||
if decl:
|
||||
features.append({
|
||||
"code": code,
|
||||
"name_key": decl.name_key,
|
||||
"limit": tier.get_limit_for_feature(code),
|
||||
"is_quantitative": decl.feature_type.value == "quantitative",
|
||||
})
|
||||
|
||||
tiers.append({
|
||||
"code": tier.code,
|
||||
"name": tier.name,
|
||||
"name": tier.get_translated_name(language),
|
||||
"price_monthly": tier.price_monthly_cents / 100,
|
||||
"price_annual": (tier.price_annual_cents / 100)
|
||||
if tier.price_annual_cents
|
||||
else None,
|
||||
"feature_codes": feature_codes,
|
||||
"features": features,
|
||||
"products_limit": tier.get_limit_for_feature("products_limit"),
|
||||
"orders_per_month": tier.get_limit_for_feature("orders_per_month"),
|
||||
"team_members": tier.get_limit_for_feature("team_members"),
|
||||
|
||||
Reference in New Issue
Block a user