Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Uses I18n.localize instead of strftime for posts#archives title and no_articles message (plus small fr locale fix) #328

Merged
merged 2 commits into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
12 app/controllers/refinery/blog/posts_controller.rb
@@ -56,14 +56,14 @@ def comment
def archive
if params[:month].present?
date = "#{params[:month]}/#{params[:year]}"
- @archive_date = Time.parse(date)
- @date_title = @archive_date.strftime('%B %Y')
- @posts = Post.live.by_month(@archive_date).page(params[:page])
+ archive_date = Time.parse(date)
+ @date_title = ::I18n.l(archive_date, :format => '%B %Y')
+ @posts = Post.live.by_month(archive_date).page(params[:page])
else
date = "01/#{params[:year]}"
- @archive_date = Time.parse(date)
- @date_title = @archive_date.strftime('%Y')
- @posts = Post.live.by_year(@archive_date).page(params[:page])
+ archive_date = Time.parse(date)
+ @date_title = ::I18n.l(archive_date, :format => '%Y')
+ @posts = Post.live.by_year(archive_date).page(params[:page])
end
respond_with (@posts)
end
View
6 app/views/refinery/blog/posts/archive.html.erb
@@ -1,13 +1,13 @@
-<% content_for :title, "#{t('.blog_archive_for', :date => @archive_date.strftime('%B %Y'))}" %>
+<% content_for :title, "#{t('.blog_archive_for', :date => @date_title)}" %>
<% content_for :body do %>
- <h1><%= t('.blog_archive_for', :date => @archive_date.strftime('%B %Y')) %></h1>
+ <h1><%= t('.blog_archive_for', :date => @date_title) %></h1>
<% if @posts.any? %>
<section id="blog_posts">
<%= render :partial => "/refinery/blog/shared/post", :collection => @posts %>
</section>
<% else %>
- <p><%= t('.no_blog_articles_posted', :date => @archive_date.strftime('%B %Y')) %></p>
+ <p><%= t('.no_blog_articles_posted', :date => @date_title) %></p>
<% end %>
<% end %>
View
4 config/locales/fr.yml
@@ -150,8 +150,8 @@ fr:
no_blog_articles_yet: "Il n'y a aucun article pour l'instant. Restez en alerte."
posts_tagged: Articles taggés
archive:
- blog_archive_for: 'Archive du blog pour le %{date}'
- no_blog_articles_posted: "Il n'y a aucun article pour la date du %{date}. Restez en alerte."
+ blog_archive_for: 'Archive du blog pour %{date}'
+ no_blog_articles_posted: "Il n'y a aucun article pour %{date}. Restez en alerte."
activerecord:
models:
refinery/blog/category: Catégorie
Something went wrong with that request. Please try again.