From 3bd7ac199be7f6bcf1d35f8b9c044403e03dc602 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Wed, 29 Jun 2011 16:47:21 -0600 Subject: [PATCH] i18n enrollment_*.erb also make ERB::Util (ERB::Util#h, specifically) available to messages. Change-Id: I01621b3564182cacee0e52118cb6e7c5ded71e4b Reviewed-on: https://gerrit.instructure.com/4493 Tested-by: Hudson Reviewed-by: Brian Palmer --- app/messages/enrollment_accepted.email.erb | 19 +++++++++++--- app/messages/enrollment_accepted.facebook.erb | 15 ++++++++++- app/messages/enrollment_accepted.sms.erb | 17 ++++++++++-- app/messages/enrollment_accepted.summary.erb | 17 ++++++++++-- app/messages/enrollment_accepted.twitter.erb | 2 +- app/messages/enrollment_invitation.email.erb | 25 +++++++++++++----- .../enrollment_invitation.facebook.erb | 22 ++++++++++++---- app/messages/enrollment_invitation.sms.erb | 24 ++++++++++++----- .../enrollment_invitation.summary.erb | 17 ++++++++++-- .../enrollment_invitation.twitter.erb | 4 +-- .../enrollment_notification.email.erb | 25 +++++++++++++----- .../enrollment_notification.facebook.erb | 21 ++++++++++++--- app/messages/enrollment_notification.sms.erb | 24 ++++++++++++----- .../enrollment_notification.summary.erb | 17 ++++++++++-- .../enrollment_notification.twitter.erb | 2 +- .../enrollment_registration.email.erb | 26 ++++++++++++++----- app/messages/enrollment_registration.sms.erb | 24 ++++++++++++----- .../enrollment_registration.summary.erb | 20 +++++++++++--- .../enrollment_registration.twitter.erb | 2 +- app/models/message.rb | 1 + 20 files changed, 258 insertions(+), 66 deletions(-) diff --git a/app/messages/enrollment_accepted.email.erb b/app/messages/enrollment_accepted.email.erb index 056596f380e..43f7f978e64 100644 --- a/app/messages/enrollment_accepted.email.erb +++ b/app/messages/enrollment_accepted.email.erb @@ -3,10 +3,23 @@ <% end %> <% define_content :subject do %> - <%= asset.user.name %> accepted the <%= asset.course.class.to_s.capitalize %> Invitation + <%= t :subject, "%{user} accepted the Course Invitation", :user => asset.user.name %> <% end %> -<%= asset.user.name %> just accepted their invitation to participate in the <%= asset.course.class.to_s.downcase %>, <%= asset.course.name %>, as a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "%{user} just accepted their invitation to participate in the course, %{course}, as a teacher.", :user => asset.user.name, :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "%{user} just accepted their invitation to participate in the course, %{course}, as a TA.", :user => asset.user.name, :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "%{user} just accepted their invitation to participate in the course, %{course}, as an observer.", :user => asset.user.name, :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "%{user} justed accept their invitation to participate in the course, %{course}, as a designer.", :user => asset.user.name, :course => asset.course.name + else + t :body_student, "%{user} just accepted their invitation to participate in the course, %{course}, as a student.", :user => asset.user.name, :course => asset.course.name + end +%> -See the list of current enrollments here: +<%= t :details, "See the list of current enrollments here:" %> <%= content :link %> diff --git a/app/messages/enrollment_accepted.facebook.erb b/app/messages/enrollment_accepted.facebook.erb index 4abaf4199b8..83057dd8ada 100644 --- a/app/messages/enrollment_accepted.facebook.erb +++ b/app/messages/enrollment_accepted.facebook.erb @@ -2,4 +2,17 @@ http://<%= HostUrl.context_host(asset.course) %>/<%= asset.course.class.to_s.downcase.pluralize %>/<%= asset.course_id %>/details <% end %> -<%= asset.user.name %> just accepted their invitation to participate in the <%= asset.course.class.to_s.downcase %> <%= asset.course.name %> as a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "%{user} just accepted their invitation to participate in the course %{course} as a teacher.", :user => %{#{asset.user.name}}, :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "%{user} just accepted their invitation to participate in the course %{course} as a TA.", :user => %{#{asset.user.name}}, :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "%{user} just accepted their invitation to participate in the course %{course} as an observer.", :user => %{#{asset.user.name}}, :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "%{user} just accepted their invitation to participate in the course %{course} as a designer.", :user => %{#{asset.user.name}}, :course => asset.course.name + else + t :body_student, "%{user} just accepted their invitation to participate in the course %{course} as a student.", :user => %{#{asset.user.name}}, :course => asset.course.name + end +%> diff --git a/app/messages/enrollment_accepted.sms.erb b/app/messages/enrollment_accepted.sms.erb index 5529878fea6..5fc57263561 100644 --- a/app/messages/enrollment_accepted.sms.erb +++ b/app/messages/enrollment_accepted.sms.erb @@ -1,3 +1,16 @@ -<%= asset.user.name %> accepted the <%= asset.readable_type %> invitation for the <%= asset.course.class.to_s.downcase %>, <%= asset.course.name %> +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "%{user} accepted the teacher invitation for the course, %{course}", :user => asset.user.name, :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "%{user} accepted the TA invitation for the course, %{course}", :user => asset.user.name, :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "%{user} accepted the observer invitation for the course, %{course}", :user => asset.user.name, :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "%{user} accepted the designer invitation for the course, %{course}", :user => asset.user.name, :course => asset.course.name + else + t :body_student, "%{user} accepted the student invitation for the course, %{course}", :user => asset.user.name, :course => asset.course.name + end +%> -More info at <%= HostUrl.context_host(asset.course) %> +<%= t :details, "More info at %{url}", :url => HostUrl.context_host(asset.course) %> diff --git a/app/messages/enrollment_accepted.summary.erb b/app/messages/enrollment_accepted.summary.erb index bd8855884c8..cc462c33404 100644 --- a/app/messages/enrollment_accepted.summary.erb +++ b/app/messages/enrollment_accepted.summary.erb @@ -3,7 +3,20 @@ <% end %> <% define_content :subject do %> - <%= asset.user.name %> accepted the <%= asset.course.class.to_s.capitalize %> Invitation + <%= t :subject, "%{user} accepted the Course Invitation", :user => asset.user.name %> <% end %> -<%= asset.user.name %> just accepted their invitation to participate in the <%= asset.course.class.to_s.downcase %>, <%= asset.course.name %>, as a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "%{user} just accepted their invitation to participate in the course, %{course}, as a teacher.", :user => asset.user.name, :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "%{user} just accepted their invitation to participate in the course, %{course}, as a TA.", :user => asset.user.name, :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "%{user} just accepted their invitation to participate in the course, %{course}, as an observer.", :user => asset.user.name, :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "%{user} justed accept their invitation to participate in the course, %{course}, as a designer.", :user => asset.user.name, :course => asset.course.name + else + t :body_student, "%{user} just accepted their invitation to participate in the course, %{course}, as a student.", :user => asset.user.name, :course => asset.course.name + end +%> diff --git a/app/messages/enrollment_accepted.twitter.erb b/app/messages/enrollment_accepted.twitter.erb index 3524a9b2c98..9f43d82ea22 100644 --- a/app/messages/enrollment_accepted.twitter.erb +++ b/app/messages/enrollment_accepted.twitter.erb @@ -1,4 +1,4 @@ <% define_content :link do %> http://<%= HostUrl.context_host(asset.course) %>/<%= asset.course.class.to_s.downcase.pluralize %>/<%= asset.course_id %>/details <% end %> -Canvas Alert - Accepted: <%= asset.user.name %>, <%= asset.readable_type %>, <%= asset.course.class.to_s.downcase %>, <%= asset.course.name %> +<%= t :body, "Canvas Alert - Accepted: %{user}, %{enrollment_type}, course, %{course}", :user => asset.user.name, :enrollment_type => asset.readable_type, :course => asset.course.name %> diff --git a/app/messages/enrollment_invitation.email.erb b/app/messages/enrollment_invitation.email.erb index 581d99d354a..3fd2645b9b5 100644 --- a/app/messages/enrollment_invitation.email.erb +++ b/app/messages/enrollment_invitation.email.erb @@ -3,14 +3,27 @@ <% end %> <% define_content :subject do %> - <%= asset.course.class.to_s.capitalize %> Invitation + <%= t :subject, "Course Invitation" %> <% end %> -You've been invited to participate in the <%= asset.course.class.to_s.downcase %>, <%= asset.course.name %>, as a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been invited to participate in the course, %{course}, as a teacher.", :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "You've been invited to participate in the course, %{course}, as a TA.", :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "You've been invited to participate in the course, %{course}, as an observer.", :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "You've been invited to participate in the course, %{course}, as a designer.", :course => asset.course.name + else + t :body_student, "You've been invited to participate in the course, %{course}, as a student.", :course => asset.course.name + end +%> <% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %> -Name: <%= asset.user.name %> -Email: <%= asset.user.email %> -<% if email != login %>Username: <%= asset.user.pseudonym.unique_id rescue "none" %><% end %> +<%= before_label :name, "Name" %> <%= asset.user.name %> +<%= before_label :email, "Email" %> <%= asset.user.email %> +<% if email != login %><%= before_label :username, "Username" %> <%= asset.user.pseudonym.unique_id rescue t(:none, "none") %><% end %> -Visit the <%= asset.course.class.to_s.downcase %> page here: +<%= t :details, "Visit the course page here:" %> <%= content :link %> diff --git a/app/messages/enrollment_invitation.facebook.erb b/app/messages/enrollment_invitation.facebook.erb index 6f4933b75b6..1c485fb54ca 100644 --- a/app/messages/enrollment_invitation.facebook.erb +++ b/app/messages/enrollment_invitation.facebook.erb @@ -2,9 +2,21 @@ http://<%= HostUrl.context_host(asset.course) %>/<%= asset.course.class.to_s.downcase.pluralize %>/<%= asset.course_id %>?invitation=<%= asset.uuid %> <% end %> -You've been invited to participate in the <%= asset.course.class.to_s.downcase %> <%= asset.course.name %> as a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been invited to participate in the course %{course} as a teacher.", :course => %{#{h asset.course.name}} + when 'TAEnrollment' + t :body_ta, "You've been invited to participate in the course %{course} as a TA.", :course => %{#{h asset.course.name}} + when 'ObserverEnrollment' + t :body_observer, "You've been invited to participate in the course %{course} as an observer.", :course => %{#{h asset.course.name}} + when 'CourseDesignerEnrollment' + t :body_designer, "You've been invited to participate in the course %{course} as a designer.", :course => %{#{h asset.course.name}} + else + t :body_student, "You've been invited to participate in the course %{course} as a student.", :course => %{#{h asset.course.name}} + end +%> <% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %> -Name: <%= asset.user.name %> -Email: <%= asset.user.email %> -<% if email != login %>Login: <%= asset.user.pseudonym.unique_id rescue "none" %><% end %> - +<%= before_label :name, "Name" %> <%= asset.user.name %> +<%= before_label :email, "Email" %> <%= asset.user.email %> +<% if email != login %><%= before_label :username, "Username" %> <%= asset.user.pseudonym.unique_id rescue t(:none, "none") %><% end %> diff --git a/app/messages/enrollment_invitation.sms.erb b/app/messages/enrollment_invitation.sms.erb index 457f3e61184..dd2f2dc622a 100644 --- a/app/messages/enrollment_invitation.sms.erb +++ b/app/messages/enrollment_invitation.sms.erb @@ -1,8 +1,20 @@ -You've been invited to the <%= asset.course.class.to_s.downcase %> as -a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been invited to the course as a teacher." + when 'TAEnrollment' + t :body_ta, "You've been invited to the course as a TA." + when 'ObserverEnrollment' + t :body_observer, "You've been invited to the course as an observer." + when 'CourseDesignerEnrollment' + t :body_designer, "You've been invited to the course as a designer." + else + t :body_student, "You've been invited to the course as a student." + end +%> <% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %> -Name: <%= asset.user.name %> -Email: <%= asset.user.email %> -<% if email != login %>Username: <%= asset.user.pseudonym.unique_id rescue "none" %><% end %> +<%= before_label :name, "Name" %> <%= asset.user.name %> +<%= before_label :email, "Email" %> <%= asset.user.email %> +<% if email != login %><%= before_label :username, "Username" %> <%= asset.user.pseudonym.unique_id rescue t(:none, "none") %><% end %> -More info at <%= HostUrl.context_host(asset.course) %> +<%= t :details, "More info at %{url}", :url => HostUrl.context_host(asset.course) %> diff --git a/app/messages/enrollment_invitation.summary.erb b/app/messages/enrollment_invitation.summary.erb index 1026624d5bd..2781b76a3e7 100644 --- a/app/messages/enrollment_invitation.summary.erb +++ b/app/messages/enrollment_invitation.summary.erb @@ -3,7 +3,20 @@ <% end %> <% define_content :subject do %> - <%= asset.course.class.to_s.capitalize %> Invitation + <%= t :subject, "Course Invitation" %> <% end %> -You've been invited to participate in the <%= asset.course.class.to_s.downcase %>, <%= asset.course.name %>, as a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been invited to participate in the course, %{course}, as a teacher.", :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "You've been invited to participate in the course, %{course}, as a TA.", :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "You've been invited to participate in the course, %{course}, as an observer.", :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "You've been invited to participate in the course, %{course}, as a designer.", :course => asset.course.name + else + t :body_student, "You've been invited to participate in the course, %{course}, as a student.", :course => asset.course.name + end +%> diff --git a/app/messages/enrollment_invitation.twitter.erb b/app/messages/enrollment_invitation.twitter.erb index 52b23e573ef..ed14bd33ac1 100644 --- a/app/messages/enrollment_invitation.twitter.erb +++ b/app/messages/enrollment_invitation.twitter.erb @@ -1,4 +1,4 @@ -Canvas Alert - Invites<% define_content :link do %> +<% define_content :link do %> http://<%= HostUrl.context_host(asset.course) %>/<%= asset.course.class.to_s.downcase.pluralize %>/<%= asset.course_id %>?invitation=<%= asset.uuid %> <% end %> -: <%= asset.course.class.to_s.downcase %> as <%= asset.readable_type %> \ No newline at end of file +<%= t :body, "Canvas Alert - Invited: course as %{enrollment_type}", :enrollment_type => asset.readable_type %> \ No newline at end of file diff --git a/app/messages/enrollment_notification.email.erb b/app/messages/enrollment_notification.email.erb index 1719593fe02..37e58e653c6 100644 --- a/app/messages/enrollment_notification.email.erb +++ b/app/messages/enrollment_notification.email.erb @@ -3,14 +3,27 @@ <% end %> <% define_content :subject do %> - <%= asset.course.class.to_s.capitalize %> Enrollment + <%= t :subject, "Course Enrollment" %> <% end %> -You've been enrolled in the <%= asset.course.class.to_s.downcase %>, <%= asset.course.name %> as a <%= asset.readable_type %> +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been enrolled in the course, %{course}, as a teacher.", :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "You've been enrolled in the course, %{course}, as a TA.", :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "You've been enrolled in the course, %{course}, as an observer.", :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "You've been enrolled in the course, %{course}, as a designer.", :course => asset.course.name + else + t :body_student, "You've been enrolled in the course, %{course}, as a student.", :course => asset.course.name + end +%> <% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %> -Name: <%= asset.user.name %> -Email: <%= asset.user.email %> -<% if email != login %>Username: <%= asset.user.pseudonym.unique_id rescue "none" %><% end %> +<%= before_label :name, "Name" %> <%= asset.user.name %> +<%= before_label :email, "Email" %> <%= asset.user.email %> +<% if email != login %><%= before_label :username, "Username" %> <%= asset.user.pseudonym.unique_id rescue t(:none, "none") %><% end %> -Visit the <%= asset.course.class.to_s.downcase %> page here: +<%= t :details, "Visit the course page here:" %> <%= content :link %> diff --git a/app/messages/enrollment_notification.facebook.erb b/app/messages/enrollment_notification.facebook.erb index b5df47183cf..5f2143116e3 100644 --- a/app/messages/enrollment_notification.facebook.erb +++ b/app/messages/enrollment_notification.facebook.erb @@ -2,8 +2,21 @@ http://<%= HostUrl.context_host(asset.course) %>/<%= asset.course.class.to_s.downcase.pluralize %>/<%= asset.course_id %> <% end %> -You've been enrolled in the <%= asset.course.class.to_s.downcase %> <%= asset.course.name %> as a <%= asset.readable_type %> +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been enrolled in the course %{course} as a teacher.", :course => %{#{h asset.course.name}} + when 'TAEnrollment' + t :body_ta, "You've been enrolled in the course %{course} as a TA.", :course => %{#{h asset.course.name}} + when 'ObserverEnrollment' + t :body_observer, "You've been enrolled in the course %{course} as an observer.", :course => %{#{h asset.course.name}} + when 'CourseDesignerEnrollment' + t :body_designer, "You've been enrolled in the course %{course} as a designer.", :course => %{#{h asset.course.name}} + else + t :body_student, "You've been enrolled in the course %{course} as a student.", :course => %{#{h asset.course.name}} + end +%> <% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %> -Name: <%= asset.user.name %> -Email: <%= asset.user.email %> -<% if email != login %>Username: <%= asset.user.pseudonym.unique_id rescue "none" %><% end %> +<%= before_label :name, "Name" %> <%= asset.user.name %> +<%= before_label :email, "Email" %> <%= asset.user.email %> +<% if email != login %><%= before_label :username, "Username" %> <%= asset.user.pseudonym.unique_id rescue t(:none, "none") %><% end %> diff --git a/app/messages/enrollment_notification.sms.erb b/app/messages/enrollment_notification.sms.erb index 23ef03d60f4..c2699249c3f 100644 --- a/app/messages/enrollment_notification.sms.erb +++ b/app/messages/enrollment_notification.sms.erb @@ -1,8 +1,20 @@ -You've been enrolled in the <%= asset.course.class.to_s.downcase %> as -a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been enrolled in the course as a teacher." + when 'TAEnrollment' + t :body_ta, "You've been enrolled in the course as a TA." + when 'ObserverEnrollment' + t :body_observer, "You've been enrolled in the course as an observer." + when 'CourseDesignerEnrollment' + t :body_designer, "You've been enrolled in the course as a designer." + else + t :body_student, "You've been enrolled in the course as a student." + end +%> <% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %> -Name: <%= asset.user.name %> -Email: <%= asset.user.email %> -<% if email != login %>Username: <%= asset.user.pseudonym.unique_id rescue "none" %><% end %> +<%= before_label :name, "Name" %> <%= asset.user.name %> +<%= before_label :email, "Email" %> <%= asset.user.email %> +<% if email != login %><%= before_label :username, "Username" %> <%= asset.user.pseudonym.unique_id rescue t(:none, "none") %><% end %> -More info at <%= HostUrl.context_host(asset.course) %> +<%= t :details, "More info at %{url}", :url => HostUrl.context_host(asset.course) %> diff --git a/app/messages/enrollment_notification.summary.erb b/app/messages/enrollment_notification.summary.erb index 9b5b2ae171d..efb6137afbe 100644 --- a/app/messages/enrollment_notification.summary.erb +++ b/app/messages/enrollment_notification.summary.erb @@ -3,7 +3,20 @@ <% end %> <% define_content :subject do %> - <%= asset.course.class.to_s.capitalize %> Enrollment + <%= t :subject, "Course Enrollment" %> <% end %> -You've been enrolled in the <%= asset.course.class.to_s.downcase %>, <%= asset.course.name %> as a <%= asset.readable_type %> +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been enrollment in the course, %{course}, as a teacher.", :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "You've been enrolled in the course, %{course}, as a TA.", :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "You've been enrolled in the course, %{course}, as an observer.", :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "You've been enrolled in the course, %{course}, as a designer.", :course => asset.course.name + else + t :body_student, "You've been enrolled in the course, %{course}, as a student.", :course => asset.course.name + end +%> diff --git a/app/messages/enrollment_notification.twitter.erb b/app/messages/enrollment_notification.twitter.erb index e37f0a473fd..a9dd7da7545 100644 --- a/app/messages/enrollment_notification.twitter.erb +++ b/app/messages/enrollment_notification.twitter.erb @@ -1,4 +1,4 @@ <% define_content :link do %> http://<%= HostUrl.context_host(asset.course) %>/<%= asset.course.class.to_s.downcase.pluralize %>/<%= asset.course_id %> <% end %> -Canvas Alert - Enrolled: <%= asset.course.class.to_s.downcase %> as <%= asset.readable_type %> \ No newline at end of file +<%= t :body, "Canvas Alert - Enrolled: course as %{enrollment_type}", :enrollment_type => asset.readable_type %> \ No newline at end of file diff --git a/app/messages/enrollment_registration.email.erb b/app/messages/enrollment_registration.email.erb index 2a26370afee..3fd38b35256 100644 --- a/app/messages/enrollment_registration.email.erb +++ b/app/messages/enrollment_registration.email.erb @@ -3,14 +3,28 @@ <% end %> <% define_content :subject do %> - <%= asset.course.class.to_s.capitalize %> Invitation + <%= t :subject, "Course Invitation" %> <% end %> -You've been invited to participate in a class at <%= (HostUrl.context_host((asset.user.pseudonym).account) rescue nil) || HostUrl.default_host %>. The class is called <%= asset.course.name %>, and you've been invited to participate as a <%= asset.readable_type %>. +<% website = (HostUrl.context_host((asset.user.pseudonym).account) rescue nil) || HostUrl.default_host %> +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a teacher.", :website => website, :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a TA.", :website => website, :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a observer.", :website => website, :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a designer.", :website => website, :course => asset.course.name + else + t :body_student, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a student.", :website => website, :course => asset.course.name + end +%> <% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %> -Name: <%= asset.user.name %> -Email: <%= asset.user.email %> -<% if email != login %>Username: <%= asset.user.pseudonym.unique_id rescue "none" %><% end %> +<%= before_label :name, "Name" %> <%= asset.user.name %> +<%= before_label :email, "Email" %> <%= asset.user.email %> +<% if email != login %><%= before_label :username, "Username" %> <%= asset.user.pseudonym.unique_id rescue t(:none, "none") %><% end %> -You'll need register with Canvas before you can participate in the class. To get started, visit the <%= asset.course.class.to_s.downcase %> page here: +<%= t :details, "You'll need register with Canvas before you can participate in the class. To get started, visit the course page here:" %> <%= content :link %> diff --git a/app/messages/enrollment_registration.sms.erb b/app/messages/enrollment_registration.sms.erb index 457f3e61184..dd2f2dc622a 100644 --- a/app/messages/enrollment_registration.sms.erb +++ b/app/messages/enrollment_registration.sms.erb @@ -1,8 +1,20 @@ -You've been invited to the <%= asset.course.class.to_s.downcase %> as -a <%= asset.readable_type %>. +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been invited to the course as a teacher." + when 'TAEnrollment' + t :body_ta, "You've been invited to the course as a TA." + when 'ObserverEnrollment' + t :body_observer, "You've been invited to the course as an observer." + when 'CourseDesignerEnrollment' + t :body_designer, "You've been invited to the course as a designer." + else + t :body_student, "You've been invited to the course as a student." + end +%> <% email = asset.user.email; login = (asset.user.pseudonym.unique_id rescue "none") %> -Name: <%= asset.user.name %> -Email: <%= asset.user.email %> -<% if email != login %>Username: <%= asset.user.pseudonym.unique_id rescue "none" %><% end %> +<%= before_label :name, "Name" %> <%= asset.user.name %> +<%= before_label :email, "Email" %> <%= asset.user.email %> +<% if email != login %><%= before_label :username, "Username" %> <%= asset.user.pseudonym.unique_id rescue t(:none, "none") %><% end %> -More info at <%= HostUrl.context_host(asset.course) %> +<%= t :details, "More info at %{url}", :url => HostUrl.context_host(asset.course) %> diff --git a/app/messages/enrollment_registration.summary.erb b/app/messages/enrollment_registration.summary.erb index cbb4128028b..e3b7c30405e 100644 --- a/app/messages/enrollment_registration.summary.erb +++ b/app/messages/enrollment_registration.summary.erb @@ -3,9 +3,21 @@ <% end %> <% define_content :subject do %> - <%= asset.course.class.to_s.capitalize %> Invitation + <%= t :subject, "Course Invitation" %> <% end %> -You've been invited to participate in a class at <%= (HostUrl.context_host((asset.user.pseudonym).account) rescue nil) || HostUrl.default_host %>. The class is -called <%= asset.course.name %>, and you've been invited to -participate as a <%= asset.readable_type %>. +<% website = (HostUrl.context_host((asset.user.pseudonym).account) rescue nil) || HostUrl.default_host %> +<%= + case asset.type + when 'TeacherEnrollment' + t :body_teacher, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a teacher.", :website => website, :course => asset.course.name + when 'TAEnrollment' + t :body_ta, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a TA.", :website => website, :course => asset.course.name + when 'ObserverEnrollment' + t :body_observer, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a observer.", :website => website, :course => asset.course.name + when 'CourseDesignerEnrollment' + t :body_designer, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a designer.", :website => website, :course => asset.course.name + else + t :body_student, "You've been invited to participate in a class at %{website}. The class is called %{course}, and you've been invited to participate as a student.", :website => website, :course => asset.course.name + end +%> diff --git a/app/messages/enrollment_registration.twitter.erb b/app/messages/enrollment_registration.twitter.erb index 86208c67319..ee5a60ebdbe 100644 --- a/app/messages/enrollment_registration.twitter.erb +++ b/app/messages/enrollment_registration.twitter.erb @@ -1,4 +1,4 @@ <% define_content :link do %> http://<%= HostUrl.context_host(asset.course) %>/<%= asset.course.class.to_s.downcase.pluralize %>/<%= asset.course_id %>?invitation=<%= asset.uuid %> <% end %> -Canvas Alert - Invited: <%= asset.course.class.to_s.downcase %> as <%= asset.readable_type %> \ No newline at end of file +<%= t :body, "Canvas Alert - Invited: course as %{enrollment_type}", :enrollment_type => asset.readable_type %> diff --git a/app/models/message.rb b/app/models/message.rb index ff75dd494b0..6d021c06ce3 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -268,6 +268,7 @@ class Message < ActiveRecord::Base message = File.read(path) @message_content_link = nil; @message_content_subject = nil self.extend TextHelper + self.extend ERB::Util b = binding if path_type == 'facebook'