Skip to content

Commit

Permalink
improve i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Pirozhkov committed May 10, 2012
1 parent 61cde3b commit 650ceb2
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 43 deletions.
8 changes: 2 additions & 6 deletions app/helpers/spree/blogs/posts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module Spree::Blogs::PostsHelper
def post_seo_path(blog, post)
spree.full_post_path(blog, post.year, post.month, post.day, post.to_param)
end

def post_seo_url(blog, post)
spree.full_post_url(blog, post.year, post.month, post.day, post.to_param)
end

def post_rss(post)
output = []
post.images.each do |image|
Expand All @@ -16,9 +16,5 @@ def post_rss(post)
output << post.rendered_body
output.join("\n").html_safe
end

def date_full(date)
date.strftime('%A %B %d, %Y').gsub(/\s0/, ' ')
end

end
6 changes: 3 additions & 3 deletions app/views/spree/blogs/admin/posts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<%= form.field_container :posted_at do %>
<%= form.label :posted_at, t("activerecord.attributes.post.posted_at") %><br />
<%= form.text_field :posted_at, :class => 'text', :value => (@post.posted_at.to_s(:long) unless @post.posted_at.nil?) %><br />
<%= form.text_field :posted_at, :class => 'text', :value => (l @post.posted_at, :format => :long) unless @post.posted_at.nil?) %><br />
<%= error_message_on :post, :posted_at %>
<% end %>
Expand All @@ -38,7 +38,7 @@
$(document).ready(function() {
$('#post_posted_at').autodate();
$('#post_body').markItUp(markdownSettings);
});
});
//]]>
</script>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/spree/blogs/admin/posts/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<tr id="<%= dom_id post %>">
<td><%= link_to post.title, object_url(post) %></td>
<td><%= post.blog.nil? ? "n/a" : link_to(post.blog.name, admin_posts_path(:search => { :blog_id_equals => post.blog_id })) %></td>
<td><%= post.posted_at.strftime('%x %X') %></td>
<td><%= l post.posted_at, :format => :date_time %></td>
<td><%= post.live ? 'Yes' : 'No' %></td>
<td>
<%= link_to_edit post %> &nbsp;
Expand Down
4 changes: 2 additions & 2 deletions app/views/spree/blogs/admin/posts/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= render :partial => 'spree/blogs/admin/shared/post_tabs', :locals => {:current => "Post Details"} %>
<p>posted in <%= link_to @post.blog.name, edit_admin_blog_path(@post.blog) %></p>
<h4><%= h @post.posted_at.strftime('%A %B %d, %Y at %I:%M%p').gsub(/\s0/, ' ') %></h4>
<h4><%= h(l @post.posted_at, :format => :detailed).gsub(/\s0/, ' ') %></h4>
<br/>

<% for image in @post.images do %>
Expand All @@ -10,7 +10,7 @@
<%= RDiscount.new(@post.body).to_html.html_safe %>

<br class="clear" />

<p>
<%= link_to_edit @user %> &nbsp;
<%= link_to t('back'), collection_url %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/spree/blogs/admin/shared/_post_tabs.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

<% content_for :sidebar do %>

<h3 class="name"><%= @post.title %><span class='sku'><%= (@post.posted_at || Time.now).strftime('%x') %></span></h3>
<h3 class="name"><%= @post.title %><span class='sku'><%= l (@post.posted_at || Time.now), :format => :date_only %></span></h3>
<br clear="clear" />

<ul class="sidebar post-menu">
<li<%= ' class="active"'.html_safe if current == "Post Details" %>>
<%= link_to t(".post_details"), edit_admin_post_url(@post) %>
</li>
</li>
<li<%= ' class="active"'.html_safe if current == "Images" %>>
<%= link_to t("images"), admin_post_images_url(@post) %>
</li>
</li>
<li<%= ' class="active"'.html_safe if current == "Related Products" %>>
<%= link_to t(".related_products"), admin_post_products_url(@post) %>
</li>
</li>
<li<%= ' class="active"'.html_safe if current == "Categories" %>>
<%= link_to t(".post_categories"), admin_post_categories_url(@post) %>
</li>
Expand Down
20 changes: 10 additions & 10 deletions app/views/spree/blogs/posts/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
<% end %>

<div class="post" data-hook="post-show">

<div class="post-title" data-hook="post-show-title">
<h5><%= h @post.posted_at.strftime('%A %B %d, %Y').gsub(/\s0/, ' ') %></h5>
<h5><%= h l(@post.posted_at, :format => :date_full).gsub(/\s0/, ' ') %></h5>
<h1><%=h @post.title %></h1>
</div>
<% if @post.has_images? %>

<% if @post.has_images? %>
<div class="post-images" data-hook="post-show-image">
<% @post.images.each_with_index do |image, index| %>
<p><%= link_to image_tag(image.attachment.url(:medium), :alt => image.has_alt? ? image.alt : "#{@post.title} - Photo #{index + 1}"), image.attachment.url(:large), :id => "photo_#{index}" %></p>
<% end %>
</div>
<% end %>
<%= @post.rendered_body %>
<% end %>
<%= @post.rendered_body %>

<br class="clear"/>

<div class="post-tags" data-hook="post-show-tags">
<h5>Tagged:</h5>
<p><%= @post.tags.collect{|tag| link_to(tag.name, search_posts_path(@blog, tag.name)) }.join(", ").html_safe %></p>
Expand All @@ -31,7 +31,7 @@
<%= render 'spree/shared/products', :products => @post.products %>
</div>
<% end %>
<%= render "spree/blogs/shared/disqus_comments" %>

</div>
8 changes: 4 additions & 4 deletions app/views/spree/blogs/shared/_preview.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

<div class="post-title" data-hook="post-title">
<h2><%= link_to h(post.title), post_seo_path(@blog, post) %></h2>
<h5><%= date_full(post.posted_at) %></h5>
<h5><%= l post.posted_at, :format => :date_full %></h5>
</div>

<% if post.has_images? %>
<p class="post-images"><%= link_to image_tag(post.images.first.attachment.url, :alt => post.title), post_seo_path(@blog, post) %></p>
<% end %>
<%= post.rendered_preview %>

<br class="clear" />

<p><%= link_to t('.read_more'), post_seo_path(@blog, post) %></p>

</div>
33 changes: 20 additions & 13 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
en:

# Spree Hax! Missing translation...
image_settings_description: "Image Settings"

activerecord:
attributes:
blog:
Expand All @@ -20,36 +20,36 @@ en:
model_name: Category
name: Name
permalink: Permalink

spree:

admin:
subnav:
posts: Posts

blogs:
admin:
blogs:
new:
new_blog: New Blog
index:
new_blog: New Blog


posts:
new:
new_post: New Post
post_products:
index:
add_related_product: Add Related Products
add_related_product: Add Related Products
post_categories:
index:
manage_categories: Manage Categories
new:
new_category: New Category
edit:
edit_category: Edit Category

shared:
post_tabs:
post_details: Post Details
Expand All @@ -68,26 +68,33 @@ en:
archive:
where_to_next: Where to next?
go_to_store: "Shop the Store"
back_to_posts: "Back to the blog"
back_to_posts: "Back to the blog"
settings:
blogs: Manage Blogs
explain_blogs: Add or Edit Blogs for posts.
disqus: Disqus Settings
explain_disqus: Configure Disqus Comments for Blog.
disqus_shortname: Disqus Shortname
shared:
sidebar:
sidebar:
recent_posts: Recent Posts
categories: Categories
archives: Archive
view_archive: View Full Archive
tags: Tags
preview:
tags: Tags
preview:
read_more: Read More
post_tabs:
editing_post: Editing Post
post_details: Post Details
related_products: Related Products
post_categories: Categories
subnav:
posts: Blog Posts
posts: Blog Posts

time:
formats:
date_time: "%x %X"
date_full: "%A %B %d, %Y"
detailed: "%A %B %d, %Y at %I:%M%p"
date_only: "%x"

0 comments on commit 650ceb2

Please sign in to comment.