From 79bd1777ab0c165492122b10a22ecc2fb7cc4715 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Mon, 22 Jan 2018 11:56:39 +0000 Subject: [PATCH] Fully internationalise the issues and reports interfaces. --- app/controllers/issues_controller.rb | 4 ++- app/views/issues/_comments.html.erb | 2 +- app/views/issues/_reports.html.erb | 6 ++-- app/views/issues/index.html.erb | 30 ++++++++++---------- app/views/issues/show.html.erb | 28 +++++++++---------- app/views/reports/new.html.erb | 2 +- config/locales/en.yml | 42 ++++++++++++++++++++++++++-- test/system/issues_test.rb | 8 +++--- 8 files changed, 79 insertions(+), 43 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b46794d72..75eb3dd3a 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -8,6 +8,8 @@ class IssuesController < ApplicationController before_action :find_issue, :only => [:show, :resolve, :reopen, :ignore] def index + @title = t ".title" + if current_user.moderator? @issue_types = @moderator_issues @users = User.joins(:roles).where(:user_roles => { :role => "moderator" }) @@ -24,7 +26,7 @@ class IssuesController < ApplicationController if @find_user @issues = @issues.where(:reported_user_id => @find_user.id) else - notice = t("issues.index.search.user_not_found") + notice = t("issues.index.user_not_found") end end diff --git a/app/views/issues/_comments.html.erb b/app/views/issues/_comments.html.erb index d49ae8670..ec885aa8c 100644 --- a/app/views/issues/_comments.html.erb +++ b/app/views/issues/_comments.html.erb @@ -8,7 +8,7 @@ <%= comment.body %> - On <%= l comment.created_at.to_datetime, :format => :friendly %> + <%= t(".created_at", :datetime => l(comment.created_at.to_datetime, :format => :friendly)) %>
<% end %> diff --git a/app/views/issues/_reports.html.erb b/app/views/issues/_reports.html.erb index 9f180d1c0..5303ae0c5 100644 --- a/app/views/issues/_reports.html.erb +++ b/app/views/issues/_reports.html.erb @@ -3,13 +3,13 @@
<%= link_to user_thumbnail(report.user), :controller => :user, :action =>:view, :display_name => report.user.display_name %>
- Reported by <%= link_to report.user.display_name, :controller => :user, :action =>:view, :display_name => report.user.display_name %>
+ <%= t(".reported_by_html", :user_name => report.user.display_name, :user_url => url_for(:controller => :user, :action => :view, :display_name => report.user.display_name)) %>
- On <%= l report.updated_at.to_datetime, :format => :friendly %> + <%= t(".updated_at", :datetime => l(report.updated_at.to_datetime, :format => :friendly)) %>
- Category: <%= report.category %> + <%= t ".category", category: report.category %>
<%= report.details %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 431158c38..4a6cf3c9a 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -1,19 +1,19 @@ <% content_for :heading do %> -

List of issues:

+

<%= t ".title" %>

<% end %> <%= form_tag(issues_path, :method => :get) do %> -Search for a particular issue(s):
-<%= select :status, nil, [['open', 0],['resolved',2],['ignored',1]],{:include_blank => "Select status"},data: { behavior: 'category_dropdown' } %> -<%= select :issue_type, nil, @issue_types,{:include_blank => "Select type"}, data: { behavior: 'category_dropdown' } %> -<%= text_field_tag :search_by_user, params[:search_by_user], placeholder: "Reported User" %> -<%= select :last_reported_by, nil, @users.all.collect {|f| [f.display_name, f.id]} << ['Not updated',"nil"], {:include_blank => "Select last updated by"}, data: { behavior: 'category_dropdown' } %> -<%= submit_tag "Search" %> +

<%= t ".search_guidance" %>

+<%= select :status, nil, [['open', 0], ['resolved', 2], ['ignored', 1]], { :include_blank => t(".select_status")}, data: { behavior: 'category_dropdown' } %> +<%= select :issue_type, nil, @issue_types, { :include_blank => t(".select_type")}, data: { behavior: 'category_dropdown' } %> +<%= text_field_tag :search_by_user, params[:search_by_user], placeholder: t(".reported_user") %> +<%= select :last_reported_by, nil, @users.all.collect {|f| [f.display_name, f.id]} << [ t(".not_updated"), "nil"], { :include_blank => t(".select_last_updated_by")}, data: { behavior: 'category_dropdown' } %> +<%= submit_tag t(".search") %> <% end %>
<% if @issues.length == 0 %> -

<%= t ".search.issues_not_found" %>

+

<%= t ".issues_not_found" %>

<% end %>
@@ -21,13 +21,13 @@ Search for a particular issue(s):
- - - - - - - + + + + + + + diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 5ce3bf168..3bef03800 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,13 +1,13 @@ <% content_for :heading do %> -

<%= @issue.status.humanize %> Issue #<%= @issue.id %>

+

<%= t ".title", :status => @issue.status.humanize, :issue_id => @issue.id %>

<%= report_type(@issue.reportable_type) %> : <%= reportable_url(@issue.reportable) %>

<%= @issue.assigned_role %> - | <%= @issue.reports.count %> reports - | First reported: <%= l @issue.created_at.to_datetime, :format => :friendly %> - <%= "| Last resolved at #{l(@issue.resolved_at.to_datetime, :format =>:friendly)}" if @issue.resolved_at? %> - <%= "| Last updated at #{l(@issue.updated_at.to_datetime, :format => :friendly)} by #{@issue.user_updated.display_name}" if @issue.user_updated %> + | <%= t ".reports", :count => @issue.reports.count %> + | <%= t ".report_created_at", :datetime => l(@issue.created_at.to_datetime, :format => :friendly) %> + <%= " | " + t(".last_resolved_at", :datetime => l(@issue.resolved_at.to_datetime, :format =>:friendly)) if @issue.resolved_at? %> + <%= " | " + t(".last_updated_at", :datetime => l(@issue.updated_at.to_datetime, :format => :friendly), :displayname => @issue.user_updated.display_name ) if @issue.user_updated %>

@@ -22,28 +22,26 @@

-

Comments on this issue:

+

<%= t ".comments_on_this_issue" %>

<%= render 'comments', comments: @comments %>
diff --git a/app/views/reports/new.html.erb b/app/views/reports/new.html.erb index a39b5b151..705457cb6 100644 --- a/app/views/reports/new.html.erb +++ b/app/views/reports/new.html.erb @@ -1,5 +1,5 @@ <% content_for :heading do %> -

Report <%= reportable_url(@report.issue.reportable) %>

+

<%= t ".title_html", :link => reportable_url(@report.issue.reportable) %>

<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index e68d44543..fefa5a484 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -914,9 +914,23 @@ en: ignore: Ignore reopen: Reopen index: - search: - user_not_found: User does not exist - issues_not_found: No such issues found + title: Issues + select_status: Select Status + select_type: Select Type + select_last_updated_by: Select Last Updated By + reported_user: Reported User + not_updated: Not Updated + search: Search + search_guidance: "Search Issues:" + user_not_found: User does not exist + issues_not_found: No such issues found + status: Status + number_of_reports: Number of Reports + last_updated_at: Last Updated At + last_updated_by: Last Updated By + link_to_reports: Link to Reports + reported_user: Reported User + link_to_reported_instance: Link to Reported Instance create: successful_report: Your report has been registered sucessfully provide_details: Please provide the required details @@ -933,15 +947,37 @@ en: unable_to_fix: You are unable to fix the problem yourself resolve_with_user: You have tried to resolve the problem with the user show: + title: "%{status} Issue #%{issue_id}" + reports: + zero: No reports + one: 1 report + other: "%{count} reports" + report_created_at: "First reported at %{datetime}" + last_resolved_at: "Last resolved at %{datetime}" + last_updated_at: "Last updated at %{datetime} by %{displayname}" + reports_of_this_issue: Reports of this Issue + read_reports: Read Reports + new_reports: New Reports + other_issues_against_this_user: Other issues against this user + no_other_issues: No other issues against this user. + comments_on_this_issue: Comments on this issue comments: reassign_param: Reassign Issue? comment: provide_details: Please provide the required details comment_created: Your comment was successfully created + comments: + created_at: "On %{datetime}" + reports: + category: "Category: %{category}" + updated_at: "On %{datetime}" + reported_by_html: "Reported by %{user_name}" resolved: Issue status has been set to 'Resolved' ignored: Issue status has been set to 'Ignored' reopened: Issue status has been set to 'Open' reports: + new: + title_html: "Report %{link}" categories: DiaryEntry: spam: This Diary Entry is/contains spam diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb index 545074c30..efe523634 100644 --- a/test/system/issues_test.rb +++ b/test/system/issues_test.rb @@ -12,7 +12,7 @@ class IssuesTest < ApplicationSystemTestCase sign_in_as(create(:moderator_user)) visit issues_path - assert page.has_content?(I18n.t(".issues.index.search.issues_not_found")) + assert page.has_content?(I18n.t(".issues.index.issues_not_found")) end def test_view_issues @@ -34,19 +34,19 @@ class IssuesTest < ApplicationSystemTestCase visit issues_path fill_in "search_by_user", :with => good_user.display_name click_on "Search" - assert page.has_content?(I18n.t(".issues.index.search.issues_not_found")) + assert page.has_content?(I18n.t(".issues.index.issues_not_found")) # User doesn't exist visit issues_path fill_in "search_by_user", :with => "Nonexistant User" click_on "Search" - assert page.has_content?(I18n.t(".issues.index.search.user_not_found")) + assert page.has_content?(I18n.t(".issues.index.user_not_found")) # Find Issue against bad_user visit issues_path fill_in "search_by_user", :with => bad_user.display_name click_on "Search" - assert !page.has_content?(I18n.t(".issues.index.search.issues_not_found")) + assert !page.has_content?(I18n.t(".issues.index.issues_not_found")) end def test_commenting -- 2.39.5
StatusNumber of ReportsLast updated atLast updated byLink to reportsReported UserLink to reported instance<%= t ".status" %><%= t ".number_of_reports" %><%= t ".last_updated_at" %><%= t ".last_updated_by" %><%= t ".link_to_reports" %><%= t ".reported_user" %><%= t ".link_to_reported_instance" %>