From cf5deaba6c0225cacf52483828a631a67ba7688d Mon Sep 17 00:00:00 2001 From: Kuba Brecka <kuba.brecka@gmail.com> Date: Tue, 12 Mar 2013 19:30:56 +0100 Subject: [PATCH] 2nd try: localize date formats on server side --- app/mailers/user_notifications.rb | 4 ++-- config/locales/server.cs.yml | 4 ++++ config/locales/server.en.yml | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 22967bb6f..4a1bc1de9 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -40,7 +40,7 @@ class UserNotifications < ActionMailer::Base @site_name = SiteSetting.title - @last_seen_at = (@user.last_seen_at || @user.created_at).strftime("%m-%d-%Y") + @last_seen_at = I18n.l(@user.last_seen_at || @user.created_at, format: :short) # A list of new topics to show the user @new_topics = Topic.new_topics(min_date) @@ -54,7 +54,7 @@ class UserNotifications < ActionMailer::Base from: "#{I18n.t('user_notifications.digest.from', site_name: SiteSetting.title)} <#{SiteSetting.notification_email}>", subject: I18n.t('user_notifications.digest.subject_template', :site_name => @site_name, - :date => Time.now.strftime("%m-%d-%Y")) + :date => I18n.l(Time.now, format: :short)) end end diff --git a/config/locales/server.cs.yml b/config/locales/server.cs.yml index 48992245b..5709ce9ca 100644 --- a/config/locales/server.cs.yml +++ b/config/locales/server.cs.yml @@ -1,4 +1,8 @@ cs: + time: + formats: + short: "%d.%m.%Y" + title: "Discourse" topics: "Témata" loading: "Nahrávám" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 7bf4b0edb..0f6c9df23 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1,4 +1,8 @@ en: + time: + formats: + short: "%m-%d-%Y" + title: "Discourse" topics: "Topics" loading: "Loading"