forked from External/greenlight
Added mailer i18n (#436)
* Added mailer i18n * Added translation to mailer in the JS Also added a generic way to add JS translation through a javascript entry in the locale file * Moved line-breaks from translations to JS file
This commit is contained in:
committed by
Jesus Federico
parent
88776eaadb
commit
822dd27509
@ -43,10 +43,14 @@ $(document).on('turbolinks:load', function(){
|
||||
// Handle recording emails.
|
||||
$('.email-link').each(function(){
|
||||
$(this).click(function(){
|
||||
var subject = $(".username").text() + " has invited you to view a recording.";
|
||||
var body = "To view the recording, follow the link below:\n\n" + $(this).attr("data-pres-link");
|
||||
var footer = "\n\nThis e-mail is auto-generated by BigBlueButton.\nBigBlueButton is an open source web conferencing system. For more information on BigBlueButton, see https://bigbluebutton.org/."
|
||||
var win = window.open("mailto:?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body) + encodeURIComponent(footer), '_blank');
|
||||
var subject = $(".username").text() + " " + t('room.mailer.subject');
|
||||
var body = t('room.mailer.body') + "\n\n" + $(this).attr("data-pres-link");
|
||||
var autogenerated = "\n\n" + t('room.mailer.autogenerated') + "\n";
|
||||
var footer = t('room.mailer.footer');
|
||||
|
||||
var url = "mailto:?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body) + encodeURIComponent(autogenerated) + encodeURIComponent(footer);
|
||||
var win = window.open(url, '_blank');
|
||||
|
||||
win.focus();
|
||||
});
|
||||
});
|
||||
|
@ -89,4 +89,10 @@ module ApplicationHelper
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# Return all the translations available in the client side through javascript
|
||||
def current_translations
|
||||
@translations ||= I18n.backend.send(:translations)
|
||||
@translations[I18n.locale].with_indifferent_access[:javascript] || {}
|
||||
end
|
||||
end
|
||||
|
@ -32,6 +32,26 @@
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Rail-ish function to translate a string, according to the Rails locales
|
||||
window.t = function t(key) {
|
||||
if (!key) {
|
||||
return "";
|
||||
}
|
||||
|
||||
var keys = key.split('.');
|
||||
var value = <%= current_translations.to_json.html_safe %>; // Add I18n variables
|
||||
|
||||
keys.forEach(key => {
|
||||
if (value) {
|
||||
value = value[key];
|
||||
}
|
||||
});
|
||||
|
||||
return value ? value : "";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="app-background" data-controller="<%= params[:controller] %>" data-action="<%= params[:action] %>" data-relative-root="<%= Rails.configuration.relative_url_root || "/" %>">
|
||||
|
@ -19,28 +19,30 @@
|
||||
<div style="display:inline-block; background-color:#F5F7FB; border:1px solid #d3d3d3; padding: 25px 70px">
|
||||
<%= image_tag(Rails.configuration.branding_image) %>
|
||||
|
||||
<h1 style="margin-bottom:30px">Password Reset</h1>
|
||||
<h1 style="margin-bottom:30px">
|
||||
<%= t('mailer.user.password_reset.title') %>
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
It seems like you forgot your password for <%= t('bigbluebutton') %>
|
||||
<%= t('mailer.user.password_reset.welcome', bigbluebutton: t('bigbluebutton')) %>
|
||||
</p>
|
||||
|
||||
<p style="margin-bottom:45px;">
|
||||
If this is true, please click the link below to reset your password:
|
||||
<%= t('mailer.user.password_reset.message') %>
|
||||
</p>
|
||||
|
||||
<a
|
||||
style="background: #467fcf;color: #ffffff; padding: 10px 15px; box-shadow: 0 2px 4px 0 rgba(0,0,0,.25);border: 1px solid transparent;text-decoration:none;"
|
||||
href="<%= @url %>">
|
||||
Reset Password
|
||||
<%= t('mailer.user.password_reset.reset_link') %>
|
||||
</a>
|
||||
|
||||
<p style="margin-top:45px;">
|
||||
This link will expire in two hours.
|
||||
<%= t('mailer.user.password_reset.expire') %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can safely ignore this email if you did not request a password reset.
|
||||
<%= t('mailer.user.password_reset.ignore') %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -16,13 +16,13 @@
|
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
Password Reset
|
||||
<%= t('mailer.user.password_reset.title') %>
|
||||
|
||||
It seems like you forgot your password for <%= t('bigbluebutton') %>
|
||||
If this is true, please click the link below to reset your password:
|
||||
<%= t('mailer.user.password_reset.welcome', bigbluebutton: t('bigbluebutton')) %>
|
||||
<%= t('mailer.user.password_reset.message') %>
|
||||
|
||||
<%= @url %>
|
||||
|
||||
This link will expire in two hours.
|
||||
<%= t('mailer.user.password_reset.expire') %>
|
||||
|
||||
You can safely ignore this email if you did not request a password reset.
|
||||
<%= t('mailer.user.password_reset.ignore') %>
|
||||
|
@ -20,23 +20,25 @@
|
||||
<div style="display:inline-block; background-color:#F5F7FB; border:1px solid #d3d3d3; padding: 25px 70px">
|
||||
<%= image_tag(Rails.configuration.branding_image) %>
|
||||
|
||||
<h1 style="margin-bottom:30px">Welcome to <%= t('bigbluebutton') %>!,
|
||||
<%= @user[:name] %></h1>
|
||||
<h1 style="margin-bottom:30px">
|
||||
<%= t('mailer.user.verify_email.welcome', bigbluebutton: t('bigbluebutton'), name: @user[:name]) %>
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
You have successfully registered your <%= t('bigbluebutton') %> account, your username is:
|
||||
<%= @user[:email] %>.
|
||||
<%= t('mailer.user.verify_email.success', bigbluebutton: t('bigbluebutton'), email: @user[:email]) %>
|
||||
</p>
|
||||
|
||||
<p style="margin-bottom:45px;">
|
||||
To verify your account, just click the button below.
|
||||
<%= t('mailer.user.verify_email.verify') %>
|
||||
</p>
|
||||
|
||||
<a style="background: #467fcf;color: #ffffff; padding: 10px 15px; box-shadow: 0 2px 4px 0 rgba(0,0,0,.25);border: 1px solid transparent;text-decoration:none;" href="<%= @url %>">
|
||||
Verify Account
|
||||
<%= t('mailer.user.verify_email.verify_link') %>
|
||||
</a>
|
||||
|
||||
<p style="margin-top:45px;">Thanks for joining and have a great day!</p>
|
||||
<p style="margin-top:45px;">
|
||||
<%= t('mailer.user.verify_email.thanks') %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -16,10 +16,10 @@
|
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
Welcome to <%= t('bigbluebutton') %>!, <%= @user[:name] %>
|
||||
<%= t('mailer.user.verify_email.welcome', bigbluebutton: t('bigbluebutton'), name: @user[:name]) %>
|
||||
|
||||
You have successfully registered your <%= t('bigbluebutton') %> account, your username is: <%= @user[:email] %>.
|
||||
<%= t('mailer.user.verify_email.success', bigbluebutton: t('bigbluebutton'), email: @user[:email]) %>
|
||||
|
||||
To verify your account, just follow this link: <%= @url %>
|
||||
<%= t('mailer.user.verify_email.verify_text', url: @url) %>
|
||||
|
||||
Thanks for joining and have a great day!
|
||||
<%= t('mailer.user.verify_email.thanks') %>
|
||||
|
Reference in New Issue
Block a user