From f4095c42ec1d97a92401ce35e2aa4e5f05b07d2f Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 2 Mar 2024 21:36:29 +0100 Subject: [PATCH] Adjust `time_tooltip` method to show shorter time format --- app/helpers/bootstrap_helper.rb | 3 +-- config/locales/voc.en.yml | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/app/helpers/bootstrap_helper.rb b/app/helpers/bootstrap_helper.rb index ae1b2bfb..216c10ab 100644 --- a/app/helpers/bootstrap_helper.rb +++ b/app/helpers/bootstrap_helper.rb @@ -73,8 +73,7 @@ module BootstrapHelper end def time_tooltip(subject, placement = "bottom") - tooltip time_ago_in_words(subject.created_at), localize(subject.created_at), placement - end + tooltip time_ago_in_words(subject.created_at, scope: "datetime.distance_in_words.short"), localize(subject.created_at, format: :long), placement end ## diff --git a/config/locales/voc.en.yml b/config/locales/voc.en.yml index 58547a03..0603cf05 100644 --- a/config/locales/voc.en.yml +++ b/config/locales/voc.en.yml @@ -42,3 +42,43 @@ en: days: "days" weeks: "weeks" months: "months" + datetime: + distance_in_words: + short: + about_x_hours: + one: "1h" + other: "%{count}h" + about_x_months: + one: "1mo" + other: "%{count}mo" + about_x_years: + one: "1y" + other: "%{count}y" + almost_x_years: + one: "1y" + other: "%{count}y" + half_a_minute: 1m + less_than_x_seconds: + one: "1s" + other: "%{count}s" + less_than_x_minutes: + one: "1m" + other: "%{count}m" + over_x_years: + one: "1y" + other: "%{count}y" + x_seconds: + one: "1s" + other: "%{count}s" + x_minutes: + one: "1m" + other: "%{count}m" + x_days: + one: "1d" + other: "%{count}d" + x_months: + one: "1mo" + other: "%{count}mo" + x_years: + one: "1y" + other: "%{count}y"