<% if @this_user %>
<% if @user == @this_user %>
- <%= link_to image_tag("new.png", :border=>0) + 'New diary entry', {:controller => 'diary_entry', :action => 'new', :display_name => @user.display_name}, {:title => 'Compose a new entry in your user diary'} %>
+ <%= link_to image_tag("new.png", :border=>0) + t('diary_entry.list.new'), {:controller => 'diary_entry', :action => 'new', :display_name => @user.display_name}, {:title => t('diary_entry.list.new_title')} %>
<% end %>
<% else %>
<% if @user %>
- <%= link_to image_tag("new.png", :border=>0) + 'New diary entry', {:controller => 'diary_entry', :action => 'new', :display_name => @user.display_name}, {:title => 'Compose a new entry in your user diary'} %>
+ <%= link_to image_tag("new.png", :border=>0) + t('diary_entry.list.new'), {:controller => 'diary_entry', :action => 'new', :display_name => @user.display_name}, {:title => t('diary_entry.list.new_title')} %>
<% end %>
<% end %>
<% if @entries.empty? %>
- <p>No diary entries</p>
+ <p><%= t 'diary_entry.list.no_entries' %></p>
<% else %>
- <p>Recent diary entries:</p>
+ <p><%= t 'diary_entry.list.recent_entries' %></p>
<hr />
<%= render :partial => 'diary_entry', :collection => @entries %>
- <%= link_to "Older Entries", { :page => @entry_pages.current.next } if @entry_pages.current.next %>
+ <%= link_to t('diary_entry.list.older_entries'), { :page => @entry_pages.current.next } if @entry_pages.current.next %>
<% if @entry_pages.current.next and @entry_pages.current.previous %>|<% end %>
- <%= link_to "Newer Entries", { :page => @entry_pages.current.previous } if @entry_pages.current.previous %>
+ <%= link_to t('diary_entry.list.newer_entries'), { :page => @entry_pages.current.previous } if @entry_pages.current.previous %>
<br />
<% end %>
edit: Edit
coordinates: "Coordinates:"
diary_entry:
- new: New Diary Entry
+ list:
+ new: New Diary Entry
+ new_title: Compose a new entry in your user diary
+ no_entries: No diary entries
+ recent_entries: "Recent diary entries: "
+ older_entries: Older Entries
+ newer_entries: Newer Entries
comment_link: Comment on this entry
reply_link: Reply to this entry
comment_count:
end
+ # Check that you can get the expected response and template for all available languages
+ # Should test that there are no <span class="translation_missing">
def test_listing_diary_entries
- get :list
- assert_response :success
- assert_template 'list'
+ I18n.available_locales.each do |locale|
+ set_locale locale
+
+ get :list
+ assert_response :success, "Should be able to list the diary entries in #{locale}"
+ assert_template 'list', "Should use the list template in #{locale}"
- # Now try to find a specific user's diary entry
- get :list, {:display_name => users(:normal_user).display_name}
- assert_response :success
- assert_template 'list'
+ # Now try to find a specific user's diary entry
+ get :list, {:display_name => users(:normal_user).display_name}
+ assert_response :success, "Should be able to list the diary entries for a user in #{locale}"
+ assert_template 'list', "Should use the list template for a user in #{locale}"
+ end
end
def test_rss
@request.env["RAW_POST_DATA"] = c.to_s
end
+ def set_locale(l)
+ @request.env["HTTP_ACCEPT_LANGUAGE"] = l.to_s
+ end
+
# Used to check that the error header and the forbidden responses are given
# when the owner of the changset has their data not marked as public
def assert_require_public_data(msg = "Shouldn't be able to use API when the user's data is not public")