From 775e3d8bcab5d0e8399541ccfb2c6de53dee473a Mon Sep 17 00:00:00 2001 From: Shriyansh Date: Sat, 19 Mar 2016 03:26:50 +0530 Subject: [PATCH 1/2] use of Rails I18n data format in EventSerializer #598 --- Gemfile | 6 ++++++ Gemfile.lock | 7 +++++++ app/serializers/event_serializer.rb | 2 +- config/locales/en.yml | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index e7593f2f..c3fd1dac 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,12 @@ gem 'rolify' # to show flash messages from ajax requests gem 'unobtrusive_flash', '>=3' + +# Internationalizing gem , use gem according to version of your rails application +# gem 'rails-i18n', '~> 5.0.0.beta1' # For 5.0.0.beta1 +gem 'rails-i18n', '~> 4.0.0' # For 4.0.x +# gem 'rails-i18n', '~> 3.0.0' # For 3.x + # as state machine gem 'transitions', :require => %w( transitions active_record/transitions ) diff --git a/Gemfile.lock b/Gemfile.lock index 5af62e75..38114ed1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -357,6 +357,9 @@ GEM rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) + rails-i18n (4.0.8) + i18n (~> 0.7) + railties (~> 4.0) rails-observers (0.1.2) activemodel (~> 4.0) railties (4.2.5.2) @@ -558,6 +561,7 @@ DEPENDENCIES rails-assets-to-markdown! rails-assets-trianglify! rails-assets-waypoints! + rails-i18n (~> 4.0.0) rails-observers rdoc-generator-fivefish redcarpet @@ -579,3 +583,6 @@ DEPENDENCIES web-console (~> 2.0) webmock whenever + +BUNDLED WITH + 1.11.2 diff --git a/app/serializers/event_serializer.rb b/app/serializers/event_serializer.rb index d9e254f5..83d49ec8 100644 --- a/app/serializers/event_serializer.rb +++ b/app/serializers/event_serializer.rb @@ -5,7 +5,7 @@ class EventSerializer < ActiveModel::Serializer def date t = object.start_time - t.blank? ? '' : %{ #{t.time.strftime('%Y-%m-%dT%H:%M:%S')}#{t.formatted_offset(false)} } + t.blank? ? '' : %{ #{l t , format: :short}#{t.formatted_offset(false)} } end def speaker_ids diff --git a/config/locales/en.yml b/config/locales/en.yml index 179c14ca..bcd7cdcd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,3 +3,6 @@ en: hello: "Hello world" + time: + formats: + short: "%Y-%m-%dT%H:%M:%S" From 09ea1682866a123d30bac954a633a0fe3beed89f Mon Sep 17 00:00:00 2001 From: Shriyansh Date: Wed, 23 Mar 2016 16:50:05 +0530 Subject: [PATCH 2/2] removed comments for gem'i18n' from Gemfile --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index c3fd1dac..31826ce7 100644 --- a/Gemfile +++ b/Gemfile @@ -42,9 +42,7 @@ gem 'unobtrusive_flash', '>=3' # Internationalizing gem , use gem according to version of your rails application -# gem 'rails-i18n', '~> 5.0.0.beta1' # For 5.0.0.beta1 gem 'rails-i18n', '~> 4.0.0' # For 4.0.x -# gem 'rails-i18n', '~> 3.0.0' # For 3.x # as state machine gem 'transitions', :require => %w( transitions active_record/transitions )