From f6edaeb1894777eec6184fdb9c1f39768d1aa219 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Tue, 30 Jun 2020 21:22:02 +0200 Subject: Add translations to German and an info text regarding the resolution --- .../bwlp_guac/BwlpAuthenticationProvider.java | 6 +++--- .../java/de/bwlehrpool/bwlp_guac/ConnectionManager.java | 4 ++-- src/main/java/de/bwlehrpool/bwlp_guac/GroupField.java | 5 ----- src/main/resources/guac-manifest.json | 3 ++- src/main/resources/templates/groupField.html | 7 ++++--- src/main/resources/translations/de.json | 17 +++++++++++++++++ src/main/resources/translations/en.json | 9 +++++++++ 7 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 src/main/resources/translations/de.json diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java index 088be7f..81434f4 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpAuthenticationProvider.java @@ -104,14 +104,14 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider { if (groupJson == null) { throw new GuacamoleInsufficientCredentialsException( - "Select Location", new CredentialsInfo( + "GROUP_SELECTION.TITLE", new CredentialsInfo( Collections.singletonList(new GroupField()) )); } ObjectMapper mapper = new ObjectMapper(); - String message = "Select a Location"; + String message = "GROUP_SELECTION.TITLE"; boolean tryAgain = false; String password = ""; @@ -132,7 +132,7 @@ public class BwlpAuthenticationProvider implements AuthenticationProvider { if (response.groupid != 0 && correctPassword != null && !password.equals(correctPassword)) { tryAgain = true; - message = "Wrong password!"; + message = "GROUP_SELECTION.PASSWORD_ERROR"; } if (tryAgain) { diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java b/src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java index 62b54b6..c2d155a 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/ConnectionManager.java @@ -93,7 +93,7 @@ public class ConnectionManager { if (group == null) { // Request the user to select a group throw new GuacamoleInsufficientCredentialsException( - "Select Location", new CredentialsInfo( + "GROUP_SELECTION.TITLE", new CredentialsInfo( Collections.singletonList(new GroupField()) )); } @@ -122,7 +122,7 @@ public class ConnectionManager { if (freeClient == null) { // Request the user to select another Group throw new GuacamoleCredentialsException( - "No free client. Select another Location.", new CredentialsInfo( + "GROUP_SELECTION.NO_FREE_ERROR", new CredentialsInfo( Collections.singletonList(new GroupField()) )); } diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/GroupField.java b/src/main/java/de/bwlehrpool/bwlp_guac/GroupField.java index c0f89d7..0e9c27b 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/GroupField.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/GroupField.java @@ -3,11 +3,6 @@ package de.bwlehrpool.bwlp_guac; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.form.Field; import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; import java.util.Collection; /** diff --git a/src/main/resources/guac-manifest.json b/src/main/resources/guac-manifest.json index 178140b..2e301e9 100644 --- a/src/main/resources/guac-manifest.json +++ b/src/main/resources/guac-manifest.json @@ -8,7 +8,8 @@ "listeners" : ["de.bwlehrpool.bwlp_guac.TunnelListener"], "html" : [ "disclaimer.html" ], "translations" : [ - "translations/en.json" + "translations/en.json", + "translations/de.json" ], "js" : [ "bwlp.min.js" diff --git a/src/main/resources/templates/groupField.html b/src/main/resources/templates/groupField.html index c2ea026..168d13b 100644 --- a/src/main/resources/templates/groupField.html +++ b/src/main/resources/templates/groupField.html @@ -1,3 +1,4 @@ +
{{ 'GROUP_SELECTION.RESOLUTION_INFO' | translate }}
@@ -5,15 +6,15 @@ {{ group.name }}
- {{ group.freeCount }} available ({{ group.offlineCount }} offline) + {{ group.freeCount }} {{ 'GROUP_SELECTION.AVAILABLE' | translate }} ({{ group.offlineCount }} offline)
- Password protected + {{ 'GROUP_SELECTION.PASSWORD_PROTECTED' | translate }}
- + diff --git a/src/main/resources/translations/de.json b/src/main/resources/translations/de.json new file mode 100644 index 0000000..e4212e4 --- /dev/null +++ b/src/main/resources/translations/de.json @@ -0,0 +1,17 @@ +{ + "APP" : { + "NAME" : "bwLehrpool" + }, + "LOGIN" : { + "FIELD_HEADER_GROUP" : "" + }, + "GROUP_SELECTION" : { + "TITLE": "Wähle einen Raum aus", + "RESOLUTION_INFO": "Stelle sicher, dass das Browser Fenster die gewünschte Größe hat. Die Auflösung des Clients wird dem entsprechend gesetzt.", + "AVAILABLE": "verfügbar", + "PASSWORD_PROTECTED": "Passwortgeschützt", + "LOG_OUT": "Ausloggen", + "PASSWORD_ERROR": "Falsches Passwort!", + "NO_FREE_ERROR": "Keinen freien Client gefunden. Wähle einen anderen Raum aus." + } +} \ No newline at end of file diff --git a/src/main/resources/translations/en.json b/src/main/resources/translations/en.json index 8e4fdbc..96d9b2c 100644 --- a/src/main/resources/translations/en.json +++ b/src/main/resources/translations/en.json @@ -4,5 +4,14 @@ }, "LOGIN" : { "FIELD_HEADER_GROUP" : "" + }, + "GROUP_SELECTION" : { + "TITLE": "Select a Location", + "RESOLUTION_INFO": "Make sure your browser window has the preferred size now. The resolution of the remote client will be set accordingly.", + "AVAILABLE": "available", + "PASSWORD_PROTECTED": "Password protected", + "LOG_OUT": "Log out", + "PASSWORD_ERROR": "Wrong password!", + "NO_FREE_ERROR": "No free client. Select another Location." } } \ No newline at end of file -- cgit v1.2.3-55-g7522