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>
79 lines
3.1 KiB
Ruby
79 lines
3.1 KiB
Ruby
module Public
|
|
module RegiaHelper
|
|
def regia_board_partial(match)
|
|
board = match.effective_board_type
|
|
partial = "public/regia/#{board}"
|
|
lookup_context.exists?(partial, [], true) ? partial : "public/regia/volley"
|
|
end
|
|
|
|
def regia_header_subtitle(match, score)
|
|
board = match.effective_board_type
|
|
case board
|
|
when "basket", "timed"
|
|
live_score_period_label(match, score)
|
|
when "timer"
|
|
t("regia.board.stopwatch")
|
|
when "generic"
|
|
t("regia.board.generic_score")
|
|
else
|
|
t("regia.board.set_label", number: score.current_set)
|
|
end
|
|
end
|
|
|
|
def regia_js_i18n_json
|
|
{
|
|
periodUpdated: t("regia.js.period_updated"),
|
|
nowInPeriodTemplate: t("regia.js.now_in_period", period: "%{period}"),
|
|
setWonTitle: t("regia.modal.set_won_title"),
|
|
setWonBodyTemplate: t("regia.js.set_won_body", winner: "%{winner}"),
|
|
matchWonTitle: t("regia.js.match_won_title"),
|
|
matchWonBodyTemplate: t("regia.js.match_won_body", winner: "%{winner}"),
|
|
closeSetTitle: t("regia.board.close_set"),
|
|
closeSetConfirm: t("regia.js.close_set_confirm"),
|
|
scoreUpdateError: t("regia.js.score_update_error"),
|
|
genericError: t("regia.js.generic_error"),
|
|
setsLineTemplate: t("regia.js.sets_line", current: "%{current}", home: "%{home}", away: "%{away}"),
|
|
setPartialLabelTemplate: t("regia.board.set_label", number: "%{number}"),
|
|
freeScore: t("regia.board.free_score"),
|
|
stopwatch: t("regia.board.stopwatch"),
|
|
quarterLabelTemplate: t("regia.js.quarter_label", n: "%{n}"),
|
|
halfLabelTemplate: t("regia.js.half_label", n: "%{n}"),
|
|
overtimeBasketTemplate: t("regia.js.overtime_basket", n: "%{n}"),
|
|
overtimeOther: t("regia.js.overtime_other"),
|
|
unknownPeriod: t("regia.js.unknown_period"),
|
|
partialsPrefix: t("regia.board.partials_prefix"),
|
|
resumed: t("regia.js.resumed"),
|
|
pausedCover: t("regia.js.paused_cover"),
|
|
closed: t("regia.js.closed"),
|
|
resumeError: t("regia.js.resume_error"),
|
|
pauseError: t("regia.js.pause_error"),
|
|
closeError: t("regia.js.close_error"),
|
|
closeConfirm: t("regia.js.close_confirm"),
|
|
linkUnavailable: t("regia.js.link_unavailable"),
|
|
linkCopied: t("regia.js.link_copied"),
|
|
copyPrompt: t("regia.js.copy_prompt"),
|
|
shareRegiaText: t("regia.js.share_regia_text"),
|
|
shareLiveText: t("regia.js.share_live_text"),
|
|
previewWaiting: t("regia.preview_waiting"),
|
|
streamEnded: t("regia.preview_ended"),
|
|
resumeLabel: t("regia.resume"),
|
|
pauseLabel: t("regia.pause"),
|
|
endedBadge: t("regia.status.ended"),
|
|
pausedBadge: t("regia.status.paused"),
|
|
liveBadge: t("regia.status.live"),
|
|
waitingBadge: t("regia.status.waiting"),
|
|
subtitlePrefix: t("regia.subtitle_prefix")
|
|
}.to_json
|
|
end
|
|
|
|
def format_clock_secs(secs, count_up: false)
|
|
total = secs.to_i
|
|
return count_up ? "0:00" : "—" if total <= 0 && !count_up
|
|
|
|
m = total / 60
|
|
s = total % 60
|
|
format("%d:%02d", m, s)
|
|
end
|
|
end
|
|
end
|