From 7702a6649cc6b0bf940df888915da32fea4b1534 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 4 Sep 2019 13:23:33 +0200 Subject: [PATCH] messages --- docker/demo/application-demo.properties | 2 +- docker/demo/docker-compose.yml | 4 ++-- docker/demo/messages.properties | 1 + .../{messagess_en.properties => messages_en.properties} | 0 .../java/ch/ethz/seb/sebserver/gui/RAPSpringConfig.java | 9 +++++++++ 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 docker/demo/messages.properties rename docker/demo/{messagess_en.properties => messages_en.properties} (100%) diff --git a/docker/demo/application-demo.properties b/docker/demo/application-demo.properties index a9b83c56..25b4251f 100644 --- a/docker/demo/application-demo.properties +++ b/docker/demo/application-demo.properties @@ -4,7 +4,7 @@ server.port=8080 server.servlet.context-path=/ server.servlet.session.cookie.http-only=true server.servlet.session.tracking-modes=cookie -spring.messages.basename=messages,file:/sebserver/messagess +spring.messages.basename=file:/sebserver/messages # database server datastore.mariadb.server.address=seb-server-mariadb diff --git a/docker/demo/docker-compose.yml b/docker/demo/docker-compose.yml index 3fb90c3f..af308a42 100644 --- a/docker/demo/docker-compose.yml +++ b/docker/demo/docker-compose.yml @@ -26,8 +26,8 @@ services: - INTERNAL_PWD=somePW volumes: - ./application-demo.properties:/sebserver/application-demo.properties - - ./messagess_en.properties:/sebserver/messagess_en.properties - - ./messagess.properties:/sebserver/messagess.properties + - ./messages_en.properties:/sebserver/messages_en.properties + - ./messages.properties:/sebserver/messages.properties ports: - 8080:8080 - 9090:9090 diff --git a/docker/demo/messages.properties b/docker/demo/messages.properties new file mode 100644 index 00000000..d3f5a12f --- /dev/null +++ b/docker/demo/messages.properties @@ -0,0 +1 @@ + diff --git a/docker/demo/messagess_en.properties b/docker/demo/messages_en.properties similarity index 100% rename from docker/demo/messagess_en.properties rename to docker/demo/messages_en.properties diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/RAPSpringConfig.java b/src/main/java/ch/ethz/seb/sebserver/gui/RAPSpringConfig.java index deee0a59..b953abd7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/RAPSpringConfig.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/RAPSpringConfig.java @@ -15,11 +15,14 @@ import javax.servlet.ServletException; import org.eclipse.rap.rwt.engine.RWTServlet; import org.eclipse.rap.rwt.engine.RWTServletContextListener; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ReloadableResourceBundleMessageSource; import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; @@ -48,6 +51,12 @@ public class RAPSpringConfig { return new ServletRegistrationBean<>(new RWTServlet(), this.entrypoint + "/*"); } + @Bean + @ConfigurationProperties("spring.messages") + public MessageSource messageSource() { + return new ReloadableResourceBundleMessageSource(); + } + private static class RAPServletContextInitializer implements ServletContextInitializer { @Override public void onStartup(final ServletContext servletContext) throws ServletException {