localize matched new users email

This commit is contained in:
Nuwan 2024-11-04 17:27:23 +05:30
parent 996fbe51d0
commit 604b6f6b59
6 changed files with 51 additions and 32 deletions

View File

@ -14,6 +14,7 @@ import affiliateEN from './locales/en/affiliate.json'
import jamTracksEn from './locales/en/jamtracks.json'
import checkoutEN from './locales/en/checkout.json'
import checkoutSuccessEN from './locales/en/checkout_success.json'
import emailsEn from './locales/en/emails.json'
import commonTranslationsES from './locales/es/common.json'
import homeTranslationsES from './locales/es/home.json'

View File

@ -49,7 +49,7 @@ module JamRuby
mail(:to => user.email, :subject => "Welcome to JamKazam") do |format|
format.text
format.html
format.html { render layout: "user_mailer_beta" }
end
end

View File

@ -1,68 +1,61 @@
<p>Hi <%= @user.first_name -%>,</p>
<p><%= I18n.t 'user_mailer.new_musicians_match.greeting' -%> <%= @user.first_name -%>,</p>
<p>
The following musicians have joined JamKazam within the last week and
have low internet latency to you that will support enjoyable sessions.
If you'd like to make more musical connections, we encourage you to use
the links below to send these new users a welcome message and perhaps
arrange a session to play together.
<%= I18n.t 'user_mailer.new_musicians_match.paragraph1' -%>
</p>
<table width="100%">
<tbody>
<%
@musicians_data.each do | data | -%>
<%
musicians = data[:musicians]
latencies = data[:latencies]
musicians.each do |musician|
latency = latencies.find{|l| l[:user_id] == musician.id }
-%>
<% @musicians_data.each do | data |
musicians = data[:musicians]
latencies = data[:latencies]
musicians.each do | musician |
%>
<tr>
<td>
<%= image_tag musician.photo_url.blank?? "avatar.png" : musician.photo_url, height: '32', width: '32', host: APP_CONFIG.action_mailer.assets_host, alt="Photo" -%>
<%= image_tag musician.photo_url.blank?? "avatar.png" : musician.photo_url, height: '32', width: '32', host: APP_CONFIG.action_mailer.assets_host, alt: 'photo' -%>
</td>
<td>
<p>
<strong><%= musician.first_name %> <%= musician.last_name %></strong>
<br />
<span>Latency To You: <%= latency_info(latency) %></span>
<% if musician.last_active_timestamp -%>
<span>
<% latency = latencies.find{|l| l[:user_id] == musician.id } %>
<%= I18n.t 'user_mailer.new_musicians_match.latency_to_you' -%>: <%= latency_info(latency) %></span>
<% if musician.last_active_timestamp %>
<br />
<span>Last Active: <%= time_ago_in_words(Time.at(musician.last_active_timestamp)) %> ago</span>
<span><%= I18n.t 'user_mailer.new_musicians_match.last_active' -%>: <%= time_ago_in_words(Time.at(musician.last_active_timestamp)) %> <%= I18n.t 'user_mailer.new_musicians_match.ago' -%></span>
<% end %>
</p>
</td>
<td>
<table>
<% musician.musician_instruments.each do |mi| -%>
<% musician.musician_instruments.each do |mi| %>
<tr>
<td><%= mi.description %>:&nbsp;<%= @instrument_proficiencies[mi.proficiency_level.to_s.to_sym] %></td>
</tr>
<% end -%>
<% end %>
</table>
</td>
<td>
<table>
<tr>
<td><a href="<%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=details" style="color: #407dde;">View Profile</a></td>
<td><a href="<%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=details" style="color: #407dde;"><%= I18n.t 'user_mailer.new_musicians_match.view_profile' -%></a></td>
</tr>
<tr>
<td><a href="<%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=message" style="color: #407dde;">Send Message</a></td>
<td><a href="<%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=message" style="color: #407dde;"><%= I18n.t 'user_mailer.new_musicians_match.send_message' -%></a></td>
</tr>
<tr>
<td><a href="<%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=connect" style="color: #407dde;">Send Friend Request</a></td>
<td><a href="<%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=connect" style="color: #407dde;"><%= I18n.t 'user_mailer.new_musicians_match.send_friend_request' -%></a></td>
</tr>
</table>
</td>
</tr>
<% end -%>
<% end -%>
<% end %>
<% end %>
</tbody>
</table>
<p>
To find great musical matches across the entire JamKazam commiunity and
make new connections, use the button below to access our musician search
feature. This let you filter JamKazammers by latency, instruments, skill
level, genre interests, last active day and more.
<%= I18n.t 'user_mailer.new_musicians_match.paragraph2' -%>
</p>
<div style="text-align: center">
<a
@ -81,6 +74,6 @@
background-color 0.15s ease-in-out, border-color 0.15s ease-in-out,
box-shadow 0.15s ease-in-out;
"
>Search JamKazam Musicians</a
><%= I18n.t 'user_mailer.new_musicians_match.search_musicians' -%></a
>
</div>

View File

@ -524,7 +524,7 @@ describe "RenderMailers" do
end
end
describe "New Musician Match email" do
describe "New Musician Match email", focus: true do
let(:user) { FactoryGirl.create(:user) }
let(:user1) { FactoryGirl.create(:user, first_name: 'David', last_name: 'Macmillan', updated_at: 2.day.ago.to_i) }
let(:user2) { FactoryGirl.create(:user, first_name: 'Tom', last_name: 'Cluff', last_jam_updated_at: 1.days.ago.to_i) }
@ -543,6 +543,7 @@ describe "RenderMailers" do
before(:each) do
User.delete_all
ActionMailer::Base.deliveries.clear
I18n.default_locale = :en
end
after(:each) do

View File

@ -6,3 +6,15 @@ en:
attributes:
user:
password_digest: "Password"
user_mailer:
new_musicians_match:
greeting: "Hi"
paragraph1: "The following musicians have joined JamKazam within the last week and have low internet latency to you that will support enjoyable sessions. If you'd like to make more musical connections, we encourage you to use the links below to send these new users a welcome message and perhaps arrange a session to play together."
latency_to_you: "Latency to You"
last_active: "Last Active"
ago: "ago"
view_profile: "View Profile"
send_message: "Send Message"
send_friend_request: "Send Friend Request"
paragraph2: "To find great musical matches across the entire JamKazam commiunity and make new connections, use the button below to access our musician search feature. This let you filter JamKazammers by latency, instruments, skill level, genre interests, last active day and more."
search_musicians: "Search JamKazam Musicians"

12
web/config/locales/es.yml Normal file
View File

@ -0,0 +1,12 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
activerecord:
attributes:
user:
password_digest: "Password"
user_mailer:
new_musicians_match:
greeting: "Hola"
view_profile: "Ver Perfil"