Il selettore lingua funziona sul web e sulle app native; su Android la preferenza è persistita e applicata al riavvio. Incluse anche eliminazione replay a scope e campi pagina pubblica squadra. Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
978 B
Ruby
39 lines
978 B
Ruby
module ApplicationHelper
|
|
PLAN_ICONS = {
|
|
"free" => "fa-solid fa-seedling",
|
|
"premium_light" => "fa-solid fa-rocket",
|
|
"premium_full" => "fa-solid fa-crown"
|
|
}.freeze
|
|
|
|
def plan_icon_class(plan)
|
|
PLAN_ICONS[plan.slug] || "fa-solid fa-circle"
|
|
end
|
|
|
|
# Data/ora nel fuso dell'app (Europe/Rome) e nella lingua corrente.
|
|
def l_local(date_or_time, format: :long)
|
|
return nil if date_or_time.blank?
|
|
|
|
value = date_or_time.respond_to?(:in_time_zone) ? date_or_time.in_time_zone : date_or_time
|
|
I18n.l(value, format: format)
|
|
end
|
|
|
|
def og_locale_tag
|
|
{
|
|
it: "it_IT",
|
|
en: "en_US",
|
|
fr: "fr_FR",
|
|
de: "de_DE",
|
|
es: "es_ES"
|
|
}.fetch(I18n.locale.to_sym, "it_IT")
|
|
end
|
|
|
|
def html_lang
|
|
I18n.locale.to_s
|
|
end
|
|
|
|
def sport_catalog_options(selected = nil)
|
|
options = Sports::Catalog.as_api_list.map { |entry| [entry[:label], entry[:key]] }
|
|
options_for_select(options, Sports::Catalog.normalize_key(selected))
|
|
end
|
|
end
|