forked from External/greenlight
Email recording now translates correctly (#809)
This commit is contained in:
parent
073400b51b
commit
4a791ae0b5
|
@ -28,9 +28,15 @@ function getLocalizedString(key) {
|
||||||
var translated = I18n
|
var translated = I18n
|
||||||
|
|
||||||
// Search current language for the key
|
// Search current language for the key
|
||||||
keyArr.forEach(function(k) {
|
try {
|
||||||
translated = translated[k]
|
keyArr.forEach(function(k) {
|
||||||
})
|
translated = translated[k]
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
// Key is missing in selected language so default to english
|
||||||
|
translated = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// If key is not found, search the fallback language for the key
|
// If key is not found, search the fallback language for the key
|
||||||
if (translated === undefined) {
|
if (translated === undefined) {
|
||||||
|
|
|
@ -26,10 +26,10 @@ $(document).on('turbolinks:load', function(){
|
||||||
// Handle recording emails.
|
// Handle recording emails.
|
||||||
$('.email-link').each(function(){
|
$('.email-link').each(function(){
|
||||||
$(this).click(function(){
|
$(this).click(function(){
|
||||||
var subject = $(".username").text() + " " + t('room.mailer.subject');
|
var subject = $(".username").text() + " " + getLocalizedString('javascript.room.mailer.subject');
|
||||||
var body = t('room.mailer.body') + "\n\n" + $(this).attr("data-pres-link");
|
var body = getLocalizedString('javascript.room.mailer.body') + "\n\n" + $(this).attr("data-pres-link");
|
||||||
var autogenerated = t('room.mailer.autogenerated') + "\n";
|
var autogenerated = getLocalizedString('javascript.room.mailer.autogenerated') + "\n";
|
||||||
var footer = t('room.mailer.footer');
|
var footer = getLocalizedString('javascript.room.mailer.footer');
|
||||||
|
|
||||||
var url = "mailto:?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body) + encodeURIComponent(autogenerated) + encodeURIComponent(footer);
|
var url = "mailto:?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body) + encodeURIComponent(autogenerated) + encodeURIComponent(footer);
|
||||||
var win = window.open(url, '_blank');
|
var win = window.open(url, '_blank');
|
||||||
|
|
Loading…
Reference in New Issue