From f82f7e87a7a2d8ad3bdd12447f54f633d950de5e Mon Sep 17 00:00:00 2001 From: Sergiu Terman Date: Thu, 26 Feb 2015 22:37:12 +0200 Subject: [PATCH 1/2] Formated date on the main page --- app/views/layouts/application.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 64363d2..3800812 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -22,6 +22,6 @@ #footer %p - Se caută prin #{question_count} întrebări. Ultima actualizare: #{last_sync_date}. + Se caută prin #{question_count} întrebări. Ultima actualizare: #{last_sync_date.strftime("%m/%d/%Y")}. = link_to "info", "http://github.com/cuc-project/db" = render(partial: 'layouts/analytics') if Rails.env.production? From 1842d7f0423d2f7c9c5e7ef6687601630ab823b1 Mon Sep 17 00:00:00 2001 From: Sergiu Terman Date: Sun, 1 Mar 2015 21:41:29 +0200 Subject: [PATCH 2/2] Added time_ago_in_words feature --- app/controllers/application_controller.rb | 4 +- app/views/layouts/application.html.haml | 2 +- config/locales/en.yml | 109 +++++++++++++++++++++- 3 files changed, 112 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e1ae254..062b818 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +include ActionView::Helpers::DateHelper + class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. @@ -11,6 +13,6 @@ def question_count end def last_sync_date - Question.first.created_at + time_ago_in_words Question.first.created_at end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 3800812..64363d2 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -22,6 +22,6 @@ #footer %p - Se caută prin #{question_count} întrebări. Ultima actualizare: #{last_sync_date.strftime("%m/%d/%Y")}. + Se caută prin #{question_count} întrebări. Ultima actualizare: #{last_sync_date}. = link_to "info", "http://github.com/cuc-project/db" = render(partial: 'layouts/analytics') if Rails.env.production? diff --git a/config/locales/en.yml b/config/locales/en.yml index c2653af..c24868b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -35,4 +35,111 @@ en: one: "A fost găsită o singură întrebare" other: "Toate întrebările" more_pages: - display_entries: "Întrebările %{first} - %{last} din %{total} total" \ No newline at end of file + display_entries: "Întrebările %{first} - %{last} din %{total} total" + date: + abbr_day_names: + - Dum + - Lun + - Mar + - Mie + - Joi + - Vin + - Sâm + abbr_month_names: + - + - Ian + - Feb + - Mar + - Apr + - Mai + - Iun + - Iul + - Aug + - Sep + - Oct + - Noi + - Dec + day_names: + - Duminică + - Luni + - Marți + - Miercuri + - Joi + - Vineri + - Sâmbată + formats: + default: "%d-%m-%Y" + long: "%d %B %Y" + short: "%d %b" + month_names: + - + - Ianuarie + - Februarie + - Martie + - Aprilie + - Mai + - Iunie + - Iulie + - August + - Septembrie + - Octombrie + - Noiembrie + - Decembrie + order: + - :day + - :month + - :year + datetime: + distance_in_words: + about_x_hours: + one: aproximativ o oră + few: aproximativ %{count} ore + other: aproximativ %{count} ore + about_x_months: + one: aproximativ o lună + few: aproximativ %{count} luni + other: aproximativ %{count} luni + about_x_years: + one: aproximativ un an + few: aproximativ %{count} ani + other: aproximativ %{count} ani + almost_x_years: + one: aproape 1 an + few: aproape %{count} ani + other: aproape %{count} ani + half_a_minute: jumătate de minut + less_than_x_minutes: + one: mai puțin de un minut + few: mai puțin de %{count} minute + other: mai puțin de %{count} minute + less_than_x_seconds: + one: mai puțin de o secundă + few: mai puțin de %{count} secunde + other: mai puțin de %{count} secunde + over_x_years: + one: mai mult de un an + few: mai mult de %{count} ani + other: mai mult de %{count} ani + x_days: + one: 1 zi + few: "%{count} zile" + other: "%{count} zile" + x_minutes: + one: 1 minut + few: "%{count} minute" + other: "%{count} minute" + x_months: + one: 1 lună + few: "%{count} luni" + other: "%{count} luni" + x_seconds: + one: 1 secundă + few: "%{count} secunde" + other: "%{count} secunde" + prompts: + day: Ziua + hour: Ora + minute: Minutul + month: Luna + second: Secunda + year: Anul