Commit e72efed3 authored by Michał Zając's avatar Michał Zając Committed by Rémy Coutable

Change s_() calls to _() calls

There are no namespaces in the strings so we don't need those
parent ee01d54a
......@@ -98,16 +98,17 @@ module EmailsHelper
case format
when :html
" via merge request #{link_to(merge_request.to_reference, merge_request.web_url)}"
merge_request_link = link_to(merge_request.to_reference, merge_request.web_url)
_("via merge request %{link}").html_safe % { link: merge_request_link }
else
# If it's not HTML nor text then assume it's text to be safe
" via merge request #{merge_request.to_reference} (#{merge_request.web_url})"
_("via merge request %{link}") % { link: "#{merge_request.to_reference} (#{merge_request.web_url})" }
end
when String
# Technically speaking this should be Commit but per
# https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15610#note_163812339
# we can't deserialize Commit without custom serializer for ActiveJob
" via #{closed_via}"
_("via %{closed_via}") % { closed_via: closed_via }
else
""
end
......
......@@ -29,7 +29,7 @@ module Issues
event_service.close_issue(issue, current_user)
create_note(issue, closed_via) if system_note
closed_via = "commit #{closed_via.id}" if closed_via.is_a?(Commit)
closed_via = _("commit %{commit_id}") % { commit_id: closed_via.id } if closed_via.is_a?(Commit)
notification_service.async.close_issue(issue, current_user, closed_via: closed_via) if notifications
todo_service.close_issue(issue, current_user)
......
%p
Issue was closed by #{sanitize_name(@updated_by.name)} #{closure_reason_text(@closed_via, format: formats.first)}.
= _("Issue was closed by %{name} %{reason}").html_safe % { name: sanitize_name(@updated_by.name), reason: closure_reason_text(@closed_via, format: formats.first) }
Issue was closed by #{sanitize_name(@updated_by.name)} #{closure_reason_text(@closed_via, format: formats.first)}.
= _("Issue was closed by %{name} %{reason}").html_safe % { name: sanitize_name(@updated_by.name), reason: closure_reason_text(@closed_via, format: formats.first) }
Issue ##{@issue.iid}: #{project_issue_url(@issue.project, @issue)}
---
title: I18n for issue closure reason in emails
merge_request: 28489
author: Michał Zając
type: changed
......@@ -5444,6 +5444,9 @@ msgstr ""
msgid "Issue update failed"
msgstr ""
msgid "Issue was closed by %{name} %{reason}"
msgstr ""
msgid "IssueBoards|Board"
msgstr ""
......@@ -11988,6 +11991,9 @@ msgstr ""
msgid "commented on %{link_to_project}"
msgstr ""
msgid "commit %{commit_id}"
msgstr ""
msgid "confidentiality|You are going to turn off the confidentiality. This means <strong>everyone</strong> will be able to see and leave a comment on this issue."
msgstr ""
......@@ -12513,6 +12519,12 @@ msgstr ""
msgid "verify ownership"
msgstr ""
msgid "via %{closed_via}"
msgstr ""
msgid "via merge request %{link}"
msgstr ""
msgid "view it on GitLab"
msgstr ""
......
......@@ -8,19 +8,19 @@ describe EmailsHelper do
context "and format is text" do
it "returns plain text" do
expect(closure_reason_text(merge_request, format: :text)).to eq(" via merge request #{merge_request.to_reference} (#{merge_request_presenter.web_url})")
expect(closure_reason_text(merge_request, format: :text)).to eq("via merge request #{merge_request.to_reference} (#{merge_request_presenter.web_url})")
end
end
context "and format is HTML" do
it "returns HTML" do
expect(closure_reason_text(merge_request, format: :html)).to eq(" via merge request #{link_to(merge_request.to_reference, merge_request_presenter.web_url)}")
expect(closure_reason_text(merge_request, format: :html)).to eq("via merge request #{link_to(merge_request.to_reference, merge_request_presenter.web_url)}")
end
end
context "and format is unknown" do
it "returns plain text" do
expect(closure_reason_text(merge_request, format: :text)).to eq(" via merge request #{merge_request.to_reference} (#{merge_request_presenter.web_url})")
expect(closure_reason_text(merge_request, format: :text)).to eq("via merge request #{merge_request.to_reference} (#{merge_request_presenter.web_url})")
end
end
end
......@@ -29,7 +29,7 @@ describe EmailsHelper do
let(:closed_via) { "5a0eb6fd7e0f133044378c662fcbbc0d0c16dbfa" }
it "returns plain text" do
expect(closure_reason_text(closed_via)).to eq(" via #{closed_via}")
expect(closure_reason_text(closed_via)).to eq("via #{closed_via}")
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment