Translate welcome email.

This commit is contained in:
Paulo Gustavo Veiga 2022-03-27 07:32:53 -03:00
parent 20b2e8f1e8
commit f70f1d89ab
10 changed files with 92 additions and 92 deletions

View File

@ -23,37 +23,35 @@ import com.wisemapping.model.Collaboration;
import com.wisemapping.model.Mindmap; import com.wisemapping.model.Mindmap;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import com.wisemapping.rest.model.RestLogItem; import com.wisemapping.rest.model.RestLogItem;
import com.wisemapping.util.VelocityEngineUtils;
import com.wisemapping.util.VelocityEngineWrapper;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringEscapeUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.ResourceBundleMessageSource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
final public class NotificationService { final public class NotificationService {
final private static Logger logger = Logger.getLogger(Mailer.class); final private static Logger logger = Logger.getLogger(Mailer.class);
final private static String DEFAULT_WISE_URL = "http://localhost:8080/wisemapping"; final private static String DEFAULT_WISE_URL = "http://localhost:8080/wisemapping";
private VelocityEngineWrapper velocityEngineWrapper;
private ResourceBundleMessageSource messageSource;
@Autowired @Autowired
private Mailer mailer; private Mailer mailer;
private String baseUrl; private String baseUrl;
public NotificationService() {
NotifierFilter notificationFilter = new NotifierFilter();
}
public void newCollaboration(@NotNull Collaboration collaboration, @NotNull Mindmap mindmap, @NotNull User user, @Nullable String message) { public void newCollaboration(@NotNull Collaboration collaboration, @NotNull Mindmap mindmap, @NotNull User user, @Nullable String message) {
try { try {
@ -106,10 +104,11 @@ final public class NotificationService {
} }
public void newAccountCreated(@NotNull User user) { public void newAccountCreated(@NotNull User user) {
final String mailSubject = "Welcome to WiseMapping !"; final Locale locale = LocaleContextHolder.getLocale();
final String messageTitle = "Your account has been created successfully";
final String messageBody = final String mailSubject = messageSource.getMessage("REGISTRATION.EMAIL_SUBJECT", null, locale);
"<p> Thank you for your interest in WiseMapping. Click <a href='https://app.wisemapping.com/c/login'>here</a> to start creating and sharing new mind maps. If have any feedback or idea, send us an email to <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a> .We'd love to hear from you.</p>"; final String messageTitle = messageSource.getMessage("REGISTRATION.EMAIL_TITLE", null, locale);
final String messageBody = messageSource.getMessage("REGISTRATION.EMAIL_BODY", null, locale);
sendTemplateMail(user, mailSubject, messageTitle, messageBody); sendTemplateMail(user, mailSubject, messageTitle, messageBody);
} }
@ -160,10 +159,6 @@ final public class NotificationService {
// } // }
} }
public void setVelocityEngineWrapper(VelocityEngineWrapper engine) {
this.velocityEngineWrapper = engine;
}
public void reportJavascriptException(@Nullable Mindmap mindmap, @Nullable User user, @NotNull RestLogItem errorItem, @NotNull HttpServletRequest request) { public void reportJavascriptException(@Nullable Mindmap mindmap, @Nullable User user, @NotNull RestLogItem errorItem, @NotNull HttpServletRequest request) {
final Map<String, String> summary = new HashMap<>(); final Map<String, String> summary = new HashMap<>();
@ -236,6 +231,11 @@ final public class NotificationService {
public void setBaseUrl(String baseUrl) { public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl; this.baseUrl = baseUrl;
} }
public void setMessageSource(ResourceBundleMessageSource messageSource) {
this.messageSource = messageSource;
}
} }

View File

@ -124,15 +124,4 @@ public class AccountController extends BaseController {
} }
userService.removeUser(user); userService.removeUser(user);
} }
@RequestMapping(method = RequestMethod.POST, value = "/logger/editor", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void logError(@RequestBody RestLogItem item, @NotNull HttpServletRequest request) {
final Mindmap mindmap = mindmapService.findMindmapById(item.getMapId());
final User user = Utils.getUser();
notificationService.reportJavascriptException(mindmap, user, item, request);
}
} }

View File

@ -138,17 +138,4 @@ public class AdminController extends BaseController {
userService.removeUser(user); userService.removeUser(user);
} }
private boolean isWelcomeMap(@NotNull Mindmap mindmap) throws UnsupportedEncodingException {
// Is welcome map ?
final String xmlStr = mindmap.getXmlStr();
boolean oldWelcomeMap = xmlStr.contains("Welcome to WiseMapping") && xmlStr.contains("My Wisemaps");
return oldWelcomeMap;
}
public boolean isSimpleMap(@NotNull Mindmap mindmap) throws UnsupportedEncodingException {
String xmlStr = mindmap.getXmlStr();
String[] topics = xmlStr.split(Pattern.quote("<topic"));
return topics.length <= 3;
}
} }

View File

@ -51,3 +51,7 @@ TRY_WELCOME = Dieser Ausgabebereich zeigt einige der Mindmap-Editor-Funktionen \
UNEXPECTED_ERROR_DETAILS = Unerwarteter Fehler bei der Verarbeitung der Anforderung. UNEXPECTED_ERROR_DETAILS = Unerwarteter Fehler bei der Verarbeitung der Anforderung.
NO_ENOUGH_PERMISSIONS=Diese map ist nicht mehr verfügbar. NO_ENOUGH_PERMISSIONS=Diese map ist nicht mehr verfügbar.
NO_ENOUGH_PERMISSIONS_DETAILS=Sie haben nicht die erforderlichen Rechte, um sich diese map anzusehen. Diese map ist entweder privat oder wurde gelöscht. NO_ENOUGH_PERMISSIONS_DETAILS=Sie haben nicht die erforderlichen Rechte, um sich diese map anzusehen. Diese map ist entweder privat oder wurde gelöscht.
REGISTRATION.EMAIL_SUBJECT=Willkommen bei WiseMapping!
REGISTRATION.EMAIL_TITLE=Ihr Konto wurde erfolgreich erstellt
REGISTRATION.EMAIL_BODY=<p> Vielen Dank für Ihr Interesse an WiseMapping. Klicken Sie <a href='https://app.wisemapping.com/c/login'>hier</a>, um mit dem Erstellen und Teilen neuer Mindmaps zu beginnen. Wenn Sie Feedback oder Ideen haben, senden Sie uns eine E-Mail an <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>. Wir würden uns freuen, von Ihnen zu hören.</p >

View File

@ -57,3 +57,7 @@ CAPTCHA_INVALID_INPUT_RESPONSE="Invalid input response, refresh the page and try
MINDMAP_EMPTY_ERROR=Mind map can not be empty. MINDMAP_EMPTY_ERROR=Mind map can not be empty.
INVALID_MINDMAP_FORMAT=Invalid mind map format. INVALID_MINDMAP_FORMAT=Invalid mind map format.
TOO_BIG_MINDMAP=You have reached the limit of 500 topics in a mindmap. TOO_BIG_MINDMAP=You have reached the limit of 500 topics in a mindmap.
REGISTRATION.EMAIL_SUBJECT=Welcome to WiseMapping !
REGISTRATION.EMAIL_TITLE=Your account has been created successfully
REGISTRATION.EMAIL_BODY=<p> Thank you for your interest in WiseMapping. Click <a href='https://app.wisemapping.com/c/login'>here</a> to start creating and sharing new mind maps. If have any feedback or idea, send us an email to <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a> .We'd love to hear from you.</p>

View File

@ -52,3 +52,7 @@ UNEXPECTED_ERROR_DETAILS = Error inesperado procesando tu pedido.
NO_ENOUGH_PERMISSIONS=El mapa buscado no se encuentra disponible. NO_ENOUGH_PERMISSIONS=El mapa buscado no se encuentra disponible.
NO_ENOUGH_PERMISSIONS_DETAILS=No tiene suficiente permisos de acceso para ver este mapa. El mapa no es mas publico o ha sido borrado. NO_ENOUGH_PERMISSIONS_DETAILS=No tiene suficiente permisos de acceso para ver este mapa. El mapa no es mas publico o ha sido borrado.
REGISTRATION.EMAIL_SUBJECT=Bienvenido/a a WiseMapping !
REGISTRATION.EMAIL_TITLE=Tu cuenta ha sido creada exitosamente
REGISTRATION.EMAIL_BODY=<p> Gracias por tu interest en WiseMapping. Hace click <a href='https://app.wisemapping.com/c/login'>aqui</a> para empezar a crear y compatir tus mapas mentales. Ideas y sugerencias, no dudes en contactarnos a <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>.</p>

View File

@ -51,3 +51,7 @@ TRY_WELCOME = Cet espace d'édition présente certaines des fonctionnalités de
UNEXPECTED_ERROR_DETAILS = Erreur inattendue lors du traitement de la demande. UNEXPECTED_ERROR_DETAILS = Erreur inattendue lors du traitement de la demande.
NO_ENOUGH_PERMISSIONS=Cette carte n'est plus accessible. NO_ENOUGH_PERMISSIONS=Cette carte n'est plus accessible.
NO_ENOUGH_PERMISSIONS_DETAILS=Vous n'avez pas les droits d'accès suffisants pour voir cette carte. Cette carte est devenue privée, ou a été détruite. NO_ENOUGH_PERMISSIONS_DETAILS=Vous n'avez pas les droits d'accès suffisants pour voir cette carte. Cette carte est devenue privée, ou a été détruite.
REGISTRATION.EMAIL_SUBJECT=Bienvenue sur WiseMapping !
REGISTRATION.EMAIL_TITLE=Votre compte a été créé avec succès
REGISTRATION.EMAIL_BODY=<p> Merci de l'intérêt que vous portez à WiseMapping. Cliquez <a href='https://app.wisemapping.com/c/login'>ici</a> pour commencer à créer et partager de nouvelles cartes mentales. Si vous avez des commentaires ou des idées, envoyez-nous un e-mail à <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>. Nous aimerions avoir de vos nouvelles.</p >

View File

@ -56,3 +56,7 @@ CAPTCHA_INVALID_INPUT_RESPONSE="Неверная CAPTCHA, обновите ст
MINDMAP_EMPTY_ERROR=Карта не может быть пустой. MINDMAP_EMPTY_ERROR=Карта не может быть пустой.
INVALID_MINDMAP_FORMAT=Недопустимый формат карты. INVALID_MINDMAP_FORMAT=Недопустимый формат карты.
TOO_BIG_MINDMAP= Слишком большая карта - вы достигли лимита в 500 тем. TOO_BIG_MINDMAP= Слишком большая карта - вы достигли лимита в 500 тем.
REGISTRATION.EMAIL_SUBJECT=Добро пожаловать в WiseMapping!
REGISTRATION.EMAIL_TITLE=Ваша учетная запись успешно создана
REGISTRATION.EMAIL_BODY=<p> Благодарим вас за интерес к WiseMapping. Нажмите <a href='https://app.wisemapping.com/c/login'>здесь</a>, чтобы начать создавать и публиковать новые интеллект-карты. Если у вас есть какие-либо отзывы или идеи, отправьте нам электронное письмо по адресу <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>. Мы будем рады услышать от вас.</p >

View File

@ -56,3 +56,7 @@ CAPTCHA_INVALID_INPUT_RESPONSE=输入无效,刷新页面后重试。
MINDMAP_EMPTY_ERROR=思维导图不能为空。 MINDMAP_EMPTY_ERROR=思维导图不能为空。
INVALID_MINDMAP_FORMAT=思维导图格式无效。 INVALID_MINDMAP_FORMAT=思维导图格式无效。
TOO_BIG_MINDMAP=你已经达到了一张思维导图中500个主题的限制。 TOO_BIG_MINDMAP=你已经达到了一张思维导图中500个主题的限制。
REGISTRATION.EMAIL_SUBJECT=欢迎来到智慧地图
REGISTRATION.EMAIL_TITLE=您的帐户已成功创建
REGISTRATION.EMAIL_BODY=<p> 感谢您对 WiseMapping 的关注。点击<a href='https://app.wisemapping.com/c/login'>这里</a>开始创建和分享新的思维导图。如果有任何反馈或想法,请给我们发送电子邮件至 <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>。我们很乐意听取您的意见。</p >

View File

@ -95,7 +95,7 @@
<bean id="notificationService" class="com.wisemapping.mail.NotificationService"> <bean id="notificationService" class="com.wisemapping.mail.NotificationService">
<property name="baseUrl" value="${site.baseurl}"/> <property name="baseUrl" value="${site.baseurl}"/>
<property name="mailer" ref="mailer"/> <property name="mailer" ref="mailer"/>
<property name="velocityEngineWrapper" ref="velocityEngineWrapper"/> <property name="messageSource" ref="messageSource"/>
</bean> </bean>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">