From 11a8bb181e8e08f3846368e39c63fb3a1cdd8530 Mon Sep 17 00:00:00 2001 From: bborn Date: Thu, 23 Sep 2010 14:39:46 -0500 Subject: [PATCH] Revert "fix i18n" This reverts commit 286bf6474cc1f3f5fc708ca45d89b7ebdb853f2d. Signed-off-by: bborn --- app/helpers/base_helper.rb | 6 +++--- app/models/photo.rb | 2 +- app/models/post.rb | 2 +- app/views/admin/contests.html.haml | 6 +++--- app/views/comments/_comment.html.haml | 4 ++-- app/views/homepage_features/index.html.haml | 2 +- app/views/messages/show.html.haml | 6 +++--- app/views/posts/_author_profile.html.haml | 2 +- app/views/posts/manage.html.haml | 2 +- app/views/users/_dashboard_nav.html.haml | 4 ++-- app/views/users/_profile_user_info_sidebar.html.haml | 2 +- test/unit/post_test.rb | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/helpers/base_helper.rb b/app/helpers/base_helper.rb index eeb3d1be..995542e7 100644 --- a/app/helpers/base_helper.rb +++ b/app/helpers/base_helper.rb @@ -330,17 +330,17 @@ def time_ago_in_words(from_time, to_time = Time.now, include_seconds = false) when 1..59 then :minutes_ago.l(:count => distance_in_minutes) when 60..1440 then :hours_ago.l(:count => (distance_in_minutes.to_f / 60.0).round) when 1440..2880 then :days_ago.l(:count => (distance_in_minutes.to_f / 1440.0).round) # 1.5 days to 2 days - else I18n.t(from_time, :format => :time_ago) + else I18n.l(from_time, :format => :time_ago) end end def time_ago_in_words_or_date(date) if date.to_date.eql?(Time.now.to_date) - display = I18n.t(date.to_time, :format => :time_ago) + display = I18n.l(date.to_time, :format => :time_ago) elsif date.to_date.eql?(Time.now.to_date - 1) display = :yesterday.l else - display = I18n.t(date.to_date, :format => :date_ago) + display = I18n.l(date.to_date, :format => :date_ago) end end diff --git a/app/models/photo.rb b/app/models/photo.rb index bcec6fe9..16ea57ca 100755 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -27,7 +27,7 @@ class Photo < ActiveRecord::Base attr_accessible :name, :description def display_name - (self.name && self.name.length>0) ? self.name : "#{:created_at.l.downcase}: #{I18n.t(self.created_at, :format => :published_date)}" + (self.name && self.name.length>0) ? self.name : "#{:created_at.l.downcase}: #{I18n.l(self.created_at, :format => :published_date)}" end def description_for_rss diff --git a/app/models/post.rb b/app/models/post.rb index a7176de1..3fb50de5 100755 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -182,7 +182,7 @@ def has_been_favorited_by(user = nil, remote_ip = nil) end def published_at_display(format = 'published_date') - is_live? ? published_at.strftime(I18n.t("time.formats.#{format.to_s}")) : 'Draft' + is_live? ? I18n.l(published_at, :format => format) : 'Draft' end end diff --git a/app/views/admin/contests.html.haml b/app/views/admin/contests.html.haml index bf52c2cf..53f6ea6a 100755 --- a/app/views/admin/contests.html.haml +++ b/app/views/admin/contests.html.haml @@ -18,11 +18,11 @@ - for contest in @contests %tr - %td=h I18n.t(contest.created_at, :format => :short_published_date) + %td=h I18n.l(contest.created_at, :format => :short_published_date) %td=h contest.title %td=h truncate(contest.post, :length => 250) - %td=h I18n.t(contest.begin_date, :format => :short_published_date) - %td=h I18n.t(contest.end_date, :format => :short_published_date) + %td=h I18n.l(contest.begin_date, :format => :short_published_date) + %td=h I18n.l(contest.end_date, :format => :short_published_date) %td = link_to :show.l, contest_path(contest) %br diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index 84b1273e..9c6bfa63 100755 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -8,7 +8,7 @@ %li.update %a{"href"=> commentable_url(comment), "rel"=>"bookmark"} %abbr.published{"title"=>"#{comment.created_at}"} - = I18n.t(comment.created_at, :format => :short_literal_date) + = I18n.l(comment.created_at, :format => :short_literal_date) -if ( comment.can_be_deleted_by(current_user) ) %li.delete=link_to_remote(:delete.l, {:url => comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 500 => 'alert(\'Sorry, there was a server error\'); return false', :success => visual_effect(:fade, "comment_#{comment.id}"), :confirm => :are_you_sure_you_want_to_permanently_delete_this_comment.l} ) .entry-content= comment.comment @@ -25,7 +25,7 @@ %li.update %a{"href"=> commentable_url(comment), "rel"=>"bookmark"} %abbr.published{"title"=>"#{comment.created_at}"} - = I18n.t(comment.created_at, :format => :short_literal_date) + = I18n.l(comment.created_at, :format => :short_literal_date) -if ( comment.can_be_deleted_by(current_user) ) %li.delete=link_to_remote(:delete.l, {:url => comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 500 => 'alert(\'Sorry, there was a server error\'); return false', :success => visual_effect(:fade, "comment_#{comment.id}"), :confirm => :are_you_sure_you_want_to_permanently_delete_this_comment.l} ) .entry-content= comment.comment diff --git a/app/views/homepage_features/index.html.haml b/app/views/homepage_features/index.html.haml index b57dceef..333e0ab8 100755 --- a/app/views/homepage_features/index.html.haml +++ b/app/views/homepage_features/index.html.haml @@ -17,7 +17,7 @@ - for homepage_feature in @homepage_features %tr - %td=h I18n.t(homepage_feature.created_at, :format => :short_published_date) + %td=h I18n.l(homepage_feature.created_at, :format => :short_published_date) %td %a{:href=>"#{h homepage_feature.url}"}=h homepage_feature.title %td=h truncate(homepage_feature.description, :length => 250) diff --git a/app/views/messages/show.html.haml b/app/views/messages/show.html.haml index 2a512f27..351f1c68 100755 --- a/app/views/messages/show.html.haml +++ b/app/views/messages/show.html.haml @@ -11,16 +11,16 @@ =h @message.subject -unless @message_thread - .right= h I18n.t(@message.created_at, :format => :literal_date) + .right= h I18n.l(@message.created_at, :format => :literal_date) %pre.clear.message_body= auto_link @message.body -else - .right= h I18n.t(@message_thread.parent_message.created_at, :format => :literal_date) + .right= h I18n.l(@message_thread.parent_message.created_at, :format => :literal_date) %pre.clear.message_body= auto_link @message_thread.parent_message.body %br - children = @message_thread.parent_message.children - children.each do |child| - .right=h I18n.t(child.created_at, :format => :literal_date) + .right=h I18n.l(child.created_at, :format => :literal_date) ="#{child.sender.login}:" %br %pre.message_body= auto_link child.body diff --git a/app/views/posts/_author_profile.html.haml b/app/views/posts/_author_profile.html.haml index bfd14009..dfd31c5b 100755 --- a/app/views/posts/_author_profile.html.haml +++ b/app/views/posts/_author_profile.html.haml @@ -10,7 +10,7 @@ - if user.description = truncate_words( user.description, 12, '...') %dd.member - =:member_since.l+" #{I18n.t(user.created_at, :format => :short_published_date)}" + =:member_since.l+" #{I18n.l(user.created_at, :format => :short_published_date)}" %dd.post - if user.posts.count == 1 = link_to :singular_posts.l(:count => user.posts.count), user_posts_path(user) diff --git a/app/views/posts/manage.html.haml b/app/views/posts/manage.html.haml index 455e662f..5e07d615 100755 --- a/app/views/posts/manage.html.haml +++ b/app/views/posts/manage.html.haml @@ -54,7 +54,7 @@ - @posts.each do |post| %tr %td - %abbr{:title=>"#{post.created_at}"}= I18n.t(post.created_at, :format => :published_date) + %abbr{:title=>"#{post.created_at}"}= I18n.l(post.created_at, :format => :published_date) %td %abbr{:title=>"#{post.published_at}"}= post.published_at_display %td diff --git a/app/views/users/_dashboard_nav.html.haml b/app/views/users/_dashboard_nav.html.haml index db0fa3ba..7f8b7642 100644 --- a/app/views/users/_dashboard_nav.html.haml +++ b/app/views/users/_dashboard_nav.html.haml @@ -25,8 +25,8 @@ %h3=:stats.l %ul - if @user.last_login_at - %li=:you_last_logged_in_on.l+" #{I18n.t(@user.last_login_at, :format => :published_date)}" - %li=:member_since.l+" #{I18n.t(@user.created_at, :format => :published_date)}" + %li=:you_last_logged_in_on.l+" #{I18n.l(@user.last_login_at, :format => :published_date)}" + %li=:member_since.l+" #{I18n.l(@user.created_at, :format => :published_date)}" -unless @user.posts.empty? %li=:you_have_written_blog_posts.l(:count => @user.posts.count) -unless @user.photos.empty? diff --git a/app/views/users/_profile_user_info_sidebar.html.haml b/app/views/users/_profile_user_info_sidebar.html.haml index e8d34ba7..ef01bb31 100755 --- a/app/views/users/_profile_user_info_sidebar.html.haml +++ b/app/views/users/_profile_user_info_sidebar.html.haml @@ -36,7 +36,7 @@ %li.update %a{:href=>"#{user_path(@user)}", :rel=>"bookmark"} %abbr.published{:title=>"#{@user.created_at}"} - =:member_since.l+" #{I18n.t(@user.created_at, :format => :short_published_date)}" + =:member_since.l+" #{I18n.l(@user.created_at, :format => :short_published_date)}" %li.view =:profile_views.l = "(#{@user.view_count})" diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 1bcfa659..f6879d09 100755 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -168,7 +168,7 @@ def test_should_not_set_published_at_if_republishing def test_should_show_published_at_display post = posts(:funny_post) - assert_equal post.published_at_display, I18n.t(post.published_at, :format => 'published_date') + assert_equal post.published_at_display, I18n.l(post.published_at, :format => 'published_date') end def test_should_show_published_at_display_for_draft