use I18n.t() instead of t() helper

refs FOO-2746

With Rails 6.1, using the t() helper has new default key behaviour that screws with i18nliner’s ability to derive the correct key from the text string. Since we don’t need the actionview translation helper functionality here, just use the I18n.t call instead when there is no default explicitly defined in the call.

Change-Id: I4868409cd02df2bfe36e482c23d357234cea7465
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286460
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
This commit is contained in:
Aaron Ogata 2022-03-07 06:27:39 -08:00
parent eaca21a5f1
commit b6b0ce0f76
6 changed files with 12 additions and 12 deletions

View File

@ -980,7 +980,7 @@ module ApplicationHelper
def agree_to_terms
# may be overridden by a plugin
@agree_to_terms ||
t(
I18n.t(
"I agree to the *terms of use*.",
wrapper: {
"*" => link_to('\1', "#", class: "terms_of_service_link")
@ -1174,12 +1174,12 @@ module ApplicationHelper
def link_to_parent_signup(auth_type)
data = reg_link_data(auth_type)
link_to(
t("Parents sign up here"),
I18n.t("Parents sign up here"),
"#",
id: "signup_parent",
class: "signup_link",
data: data,
title: t("Parent Signup")
title: I18n.t("Parent Signup")
)
end

View File

@ -99,7 +99,7 @@ module AttachmentHelper
send_file_headers!(length: body.length, filename: attachment.filename, disposition: "inline", type: attachment.content_type_with_encoding)
render body: body
elsif must_proxy
render 400, text: t("It's not allowed to redirect to HTML files that can't be proxied while Content-Security-Policy is being enforced")
render 400, text: I18n.t("It's not allowed to redirect to HTML files that can't be proxied while Content-Security-Policy is being enforced")
elsif inline
redirect_to authenticated_inline_url(attachment)
else

View File

@ -143,9 +143,9 @@ module CoursesHelper
return nil if MasterCourses::MasterTemplate.is_master_course?(course)
if MasterCourses::ChildSubscription.is_child_course?(course)
t("Course is already associated with a blueprint")
I18n.t("Course is already associated with a blueprint")
elsif course.student_enrollments.not_fake.exists?
t("Cannot have a blueprint course with students")
I18n.t("Cannot have a blueprint course with students")
else
nil
end

View File

@ -29,7 +29,7 @@ module EportfoliosHelper
def delete_icon(png = false)
if png
image_tag("delete.png", alt: t("Delete"))
image_tag("delete.png", alt: I18n.t("Delete"))
else
raw("&#215;")
end

View File

@ -169,12 +169,12 @@ module GradebooksHelper
end
def translated_due_date_for_speedgrader(assignment)
return t("Due: Multiple Due Dates") if assignment.multiple_due_dates_apply_to?(@current_user)
return I18n.t("Due: Multiple Due Dates") if assignment.multiple_due_dates_apply_to?(@current_user)
assignment = assignment.overridden_for(@current_user)
if assignment.due_at
return t("Due: %{assignment_due_date_time}", assignment_due_date_time: datetime_string(force_zone(assignment.due_at)))
return I18n.t("Due: %{assignment_due_date_time}", assignment_due_date_time: datetime_string(force_zone(assignment.due_at)))
end
override_dates = if assignment.only_visible_to_overrides?
@ -184,9 +184,9 @@ module GradebooksHelper
end
if override_dates.count == 1
t("Due: %{assignment_due_date_time}", assignment_due_date_time: datetime_string(force_zone(override_dates.first)))
I18n.t("Due: %{assignment_due_date_time}", assignment_due_date_time: datetime_string(force_zone(override_dates.first)))
else
t("Due: No Due Date")
I18n.t("Due: No Due Date")
end
end

View File

@ -22,7 +22,7 @@ module SubmissionCommentsHelper
if can_do(comment, @current_user, :read_author)
comment.author_name
else
t("Anonymous User")
I18n.t("Anonymous User")
end
end
end