From 1121514799014fca17622265fc479de7e302c8a0 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Wed, 6 Mar 2019 20:24:10 +0100 Subject: [PATCH] UX: Localize date format in "new user of the month" message --- .../scheduled/grant_new_user_of_the_month_badges.rb | 2 +- config/locales/server.en.yml | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb b/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb index d6a4a16d56..a14db0bbad 100644 --- a/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb +++ b/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb @@ -24,7 +24,7 @@ module Jobs BadgeGranter.grant(badge, user) SystemMessage.new(user).create('new_user_of_the_month', - month_year: Time.now.strftime("%B %Y"), + month_year: I18n.l(Time.now, format: :no_day), url: "#{Discourse.base_url}/badges" ) end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index e578529144..f457a08e08 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -25,14 +25,16 @@ en: datetime_formats: &datetime_formats formats: - # Format directives: https://ruby-doc.org/core-2.3.1/Time.html#method-i-strftime + # Format directives: https://ruby-doc.org/core-2.6.1/Time.html#method-i-strftime short: "%m-%d-%Y" - # Format directives: https://ruby-doc.org/core-2.3.1/Time.html#method-i-strftime + # Format directives: https://ruby-doc.org/core-2.6.1/Time.html#method-i-strftime short_no_year: "%B %-d" - # Format directives: https://ruby-doc.org/core-2.3.1/Time.html#method-i-strftime + # Format directives: https://ruby-doc.org/core-2.6.1/Time.html#method-i-strftime date_only: "%B %-d, %Y" - # Format directives: https://ruby-doc.org/core-2.3.1/Time.html#method-i-strftime + # Format directives: https://ruby-doc.org/core-2.6.1/Time.html#method-i-strftime long: "%B %-d, %Y, %l:%M%P" + # Format directives: https://ruby-doc.org/core-2.6.1/Time.html#method-i-strftime + no_day: "%B %Y" date: # Do not remove the brackets and commas and do not translate the first month name. It should be "null". month_names: