Completa i18n IT/EN/FR/DE/ES su sito pubblico, area autenticata e admin.
Tutte le view marketing, legali, viewer, dashboard e admin usano t(); mailer utente-facing e flash localizzati; admin con LocaleResolver e selettore lingua. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,38 +10,37 @@ module Billing
|
||||
if result.upgrade?
|
||||
amount = format_amount(result.amount_cents, result.currency)
|
||||
if amount.present?
|
||||
"Upgrade a #{plan.name} (#{interval_label}) completato. Addebito immediato: #{amount}."
|
||||
I18n.t("billing.messages.upgrade_completed_with_amount", plan: plan.name, interval: interval_label, amount: amount)
|
||||
else
|
||||
"Upgrade a #{plan.name} (#{interval_label}) completato. L'addebito della differenza è in elaborazione sulla carta salvata."
|
||||
I18n.t("billing.messages.upgrade_completed_pending_charge", plan: plan.name, interval: interval_label)
|
||||
end
|
||||
else
|
||||
when_label = result.effective_at.present? ? I18n.l(result.effective_at, format: :long) : "il prossimo rinnovo"
|
||||
current_name = current_plan&.name || "il piano attuale"
|
||||
"Passaggio a #{plan.name} (#{interval_label}) programmato: resti su #{current_name} fino al #{when_label}. " \
|
||||
"Nessun addebito aggiuntivo ora; dal prossimo ciclo pagherai il nuovo prezzo."
|
||||
when_label = result.effective_at.present? ? I18n.l(result.effective_at, format: :long) : I18n.t("billing.messages.next_renewal")
|
||||
current_name = current_plan&.name || I18n.t("billing.messages.current_plan_generic")
|
||||
I18n.t("billing.messages.downgrade_scheduled", plan: plan.name, interval: interval_label, current_name: current_name, when: when_label)
|
||||
end
|
||||
end
|
||||
|
||||
def button_label(plan:, interval:, kind:)
|
||||
price = PriceCatalog.label(plan_slug: plan.slug, interval: interval)
|
||||
if kind == :checkout
|
||||
"Attiva #{plan.name} — #{price}"
|
||||
I18n.t("billing.messages.activate_button", plan: plan.name, price: price)
|
||||
else
|
||||
"Passa a #{plan.name} — #{price}"
|
||||
I18n.t("billing.messages.switch_button", plan: plan.name, price: price)
|
||||
end
|
||||
end
|
||||
|
||||
def billing_info_lines(subscription: nil)
|
||||
lines = [
|
||||
"Upgrade (piano superiore o passaggio alla fatturazione annuale): la differenza viene addebitata subito sulla carta salvata in Stripe.",
|
||||
"Downgrade tra piani a pagamento (es. Full → Light): il nuovo piano è attivo dal prossimo rinnovo; fino ad allora restano le funzioni del piano attuale, senza addebito aggiuntivo ora."
|
||||
I18n.t("billing.messages.upgrade_info_line"),
|
||||
I18n.t("billing.messages.downgrade_info_line")
|
||||
]
|
||||
|
||||
if subscription&.plan_change_pending? && subscription.pending_plan.present?
|
||||
when_at = subscription.current_period_end
|
||||
when_label = when_at.present? ? I18n.l(when_at, format: :long) : "il prossimo rinnovo"
|
||||
when_label = when_at.present? ? I18n.l(when_at, format: :long) : I18n.t("billing.messages.next_renewal")
|
||||
lines.unshift(
|
||||
"Hai già richiesto #{subscription.pending_plan.name} dal #{when_label}: fino ad allora resta attivo #{subscription.plan.name}."
|
||||
I18n.t("billing.messages.already_requested_line", plan: subscription.pending_plan.name, when: when_label, current_plan: subscription.plan.name)
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user