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:
@@ -12,7 +12,7 @@ module Public
|
||||
|
||||
def create
|
||||
if current_user.owned_clubs.exists?
|
||||
redirect_to public_club_path(current_user.primary_club), alert: "Hai già registrato una società"
|
||||
redirect_to public_club_path(current_user.primary_club), alert: t("flash.clubs.already_registered")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ module Public
|
||||
|
||||
ClubMembership.create!(user: current_user, club: club, role: "owner")
|
||||
|
||||
first_team_name = params.dig(:first_team, :name).presence || "Prima squadra"
|
||||
first_team_name = params.dig(:first_team, :name).presence || t("club.new.default_first_team_name")
|
||||
club.teams.create!(
|
||||
name: first_team_name,
|
||||
sport: club.sport
|
||||
@@ -34,14 +34,14 @@ module Public
|
||||
if plan.in?(%w[premium_light premium_full]) && MatchLiveTv.stripe_enabled?
|
||||
unless club.billing_profile_complete?
|
||||
redirect_to public_club_billing_profile_path(club, plan: plan, interval: checkout_interval_param),
|
||||
alert: "Completa i dati di fatturazione prima di attivare un piano premium."
|
||||
alert: t("flash.clubs.complete_billing_first")
|
||||
return
|
||||
end
|
||||
|
||||
interval = checkout_interval_param
|
||||
redirect_to public_club_checkout_path(club, plan: plan, interval: interval)
|
||||
else
|
||||
redirect_to public_club_path(club), notice: "Società e prima squadra create."
|
||||
redirect_to public_club_path(club), notice: t("flash.clubs.created")
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
flash.now[:alert] = e.record.errors.full_messages.join(", ")
|
||||
@@ -66,7 +66,7 @@ module Public
|
||||
@club.assign_attributes(club_params)
|
||||
attach_branding_logo(@club)
|
||||
@club.save!
|
||||
redirect_to public_club_path(@club), notice: "Società aggiornata."
|
||||
redirect_to public_club_path(@club), notice: t("flash.clubs.updated")
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
flash.now[:alert] = e.record.errors.full_messages.join(", ")
|
||||
render :edit, status: :unprocessable_entity
|
||||
@@ -88,12 +88,12 @@ module Public
|
||||
require_club_owner!(@club)
|
||||
if @club.subscription&.admin_comped?
|
||||
redirect_to public_club_billing_path(@club),
|
||||
alert: "Il piano è un abbonamento omaggio gestito da Match Live TV. Per passare a un abbonamento a pagamento contatta il supporto."
|
||||
alert: t("flash.clubs.comped_change_denied")
|
||||
return
|
||||
end
|
||||
|
||||
unless MatchLiveTv.stripe_enabled?
|
||||
redirect_to public_club_billing_path(@club), alert: "Pagamenti non ancora configurati sul server"
|
||||
redirect_to public_club_billing_path(@club), alert: t("flash.clubs.stripe_not_configured")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -105,15 +105,15 @@ module Public
|
||||
if sub&.stripe_subscription_id.present? && sub.active? &&
|
||||
sub.plan.slug == plan_slug && sub.billing_interval == interval && !sub.plan_change_pending?
|
||||
redirect_to public_club_billing_path(@club),
|
||||
notice: "Sei già su #{target_plan.name} (#{Billing::Stripe::PriceCatalog.label(plan_slug: plan_slug, interval: interval)})."
|
||||
notice: t("flash.clubs.already_on_plan", plan: target_plan.name, price: Billing::Stripe::PriceCatalog.label(plan_slug: plan_slug, interval: interval))
|
||||
return
|
||||
end
|
||||
|
||||
if sub&.plan_change_pending? && sub.pending_plan&.slug == plan_slug &&
|
||||
sub.pending_billing_interval == interval
|
||||
when_label = sub.current_period_end.present? ? I18n.l(sub.current_period_end, format: :long) : "il prossimo rinnovo"
|
||||
when_label = sub.current_period_end.present? ? I18n.l(sub.current_period_end, format: :long) : t("billing.messages.next_renewal")
|
||||
redirect_to public_club_billing_path(@club),
|
||||
notice: "Il passaggio a #{target_plan.name} è già programmato dal #{when_label}."
|
||||
notice: t("flash.clubs.change_already_scheduled", plan: target_plan.name, date: when_label)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -134,7 +134,7 @@ module Public
|
||||
redirect_to public_club_billing_path(@club), alert: e.message
|
||||
rescue ::Stripe::StripeError => e
|
||||
Rails.logger.warn("[Stripe checkout] #{e.message}")
|
||||
redirect_to public_club_billing_path(@club), alert: "Errore Stripe: #{e.message}"
|
||||
redirect_to public_club_billing_path(@club), alert: t("flash.clubs.stripe_error", message: e.message)
|
||||
end
|
||||
|
||||
def youtube_connect
|
||||
@@ -143,7 +143,7 @@ module Public
|
||||
entitlements.assert_can_connect_youtube!
|
||||
|
||||
if ENV["YOUTUBE_CLIENT_ID"].blank?
|
||||
redirect_to public_club_path(@club), alert: "YouTube OAuth non configurato sul server"
|
||||
redirect_to public_club_path(@club), alert: t("flash.clubs.youtube_oauth_not_configured")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -161,13 +161,13 @@ module Public
|
||||
def youtube_disconnect
|
||||
require_club_owner!(@club)
|
||||
@club.youtube_credential&.destroy!
|
||||
redirect_to public_club_path(@club), notice: "Canale YouTube della società scollegato"
|
||||
redirect_to public_club_path(@club), notice: t("flash.clubs.youtube_disconnected")
|
||||
end
|
||||
|
||||
def portal
|
||||
require_club_owner!(@club)
|
||||
unless MatchLiveTv.stripe_enabled?
|
||||
redirect_to public_club_billing_path(@club), alert: "Portale pagamenti non configurato"
|
||||
redirect_to public_club_billing_path(@club), alert: t("flash.clubs.portal_not_configured")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -204,7 +204,7 @@ module Public
|
||||
@club,
|
||||
plan: plan_slug,
|
||||
interval: params[:interval].presence
|
||||
), alert: "Completa i dati di fatturazione prima di attivare un piano premium."
|
||||
), alert: t("flash.clubs.complete_billing_first")
|
||||
end
|
||||
|
||||
def checkout_interval_param
|
||||
@@ -236,10 +236,10 @@ module Public
|
||||
def apply_checkout_flash!
|
||||
case params[:checkout]
|
||||
when "success"
|
||||
plan_name = @subscription&.plan&.name || "premium"
|
||||
flash.now[:notice] = "Pagamento completato! Piano attivo: #{plan_name}."
|
||||
plan_name = @subscription&.plan&.name || "Premium"
|
||||
flash.now[:notice] = t("flash.clubs.checkout_success", plan: plan_name)
|
||||
when "canceled"
|
||||
flash.now[:alert] = "Pagamento annullato. Nessun addebito è stato effettuato."
|
||||
flash.now[:alert] = t("flash.clubs.checkout_canceled")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user