Browse Source

working on german translation

lang_de
Stephan Richter 2 years ago
parent
commit
3ce5d8e8f3
  1. 6
      src/main/java/de/srsoftware/widerhall/data/MailingList.java
  2. 52
      src/main/java/de/srsoftware/widerhall/web/Rest.java

6
src/main/java/de/srsoftware/widerhall/data/MailingList.java

@ -356,7 +356,7 @@ public class MailingList { @@ -356,7 +356,7 @@ public class MailingList {
try {
sendConfirmationRequest(user, member.token());
} catch (UnsupportedEncodingException e) {
throw new MessagingException(t("Failed to send email to {}",user.email()),e);
throw new MessagingException(t("Senden der Email an {} fehlgeschlagen",user.email()),e);
}
}
@ -368,8 +368,8 @@ public class MailingList { @@ -368,8 +368,8 @@ public class MailingList {
* @throws UnsupportedEncodingException
*/
public void test(User user) throws MessagingException, UnsupportedEncodingException {
var subject = t("{}: test mail",name());
var text = "If you received this mail, the SMTP settings of your mailing list are correct.";
var subject = t("{}: Test-Mail",name());
var text = "Wenn Sie diese Nachricht empfangen haben, sind die SMTP-Einstellungen Ihrer Mailing-Liste korrekt.";
smtp.login().send(email(),name(),user.email(),subject,text);
}
}

52
src/main/java/de/srsoftware/widerhall/web/Rest.java

@ -44,15 +44,15 @@ public class Rest extends HttpServlet { @@ -44,15 +44,15 @@ public class Rest extends HttpServlet {
try {
int perm = Integer.parseInt(permissions);
var user = User.loadAll(List.of(userEmail)).stream().findAny().orElse(null);
if (user == null) return Map.of(ERROR,t("Failed to load user for address {}",userEmail));
if (user == null) return Map.of(ERROR,t("Laden des Nutzers für die Adresse {} fehlgeschlagen",userEmail));
user.addPermission(perm);
} catch (NumberFormatException nfe){
return Map.of(ERROR,"no valid permissions provided!");
return Map.of(ERROR,"Keine gültigen Berechtigungen übergeben!");
} catch (SQLException e) {
LOG.debug("Failed to load user for address {}",userEmail,e);
return Map.of(ERROR,t("Failed to load user for address {}",userEmail));
LOG.debug("Laden des Nutzers für die Adresse {} fehlgeschlagen",userEmail,e);
return Map.of(ERROR,t("Laden des Nutzers für die Adresse {} fehlgeschlagen",userEmail));
}
return Map.of(SUCCESS,"Updated user permissions");
return Map.of(SUCCESS,"Nutzer-Berechtigungen aktualisiert");
}
@Override
@ -68,19 +68,19 @@ public class Rest extends HttpServlet { @@ -68,19 +68,19 @@ public class Rest extends HttpServlet {
}
private Map dropPermission(String userEmail, String permissions) {
if (userEmail == null || userEmail.isBlank()) return Map.of(ERROR,"missing user email address!");
if (userEmail == null || userEmail.isBlank()) return Map.of(ERROR,"Nutzer-Emailadresse fehlt!");
try {
int perm = Integer.parseInt(permissions);
var user = User.loadAll(List.of(userEmail)).stream().findAny().orElse(null);
if (user == null) return Map.of(ERROR,t("Failed to load user for address {}",userEmail));
if (user == null) return Map.of(ERROR,t("Laden des Nutzers für die Adresse {} fehlgeschlagen",userEmail));
user.dropPermission(perm);
} catch (NumberFormatException nfe){
return Map.of(ERROR,"no valid permissions provided!");
return Map.of(ERROR,"Keine gültigen Berechtigungen übergeben!");
} catch (SQLException e) {
LOG.debug("Failed to load user for address {}",userEmail,e);
return Map.of(ERROR,t("Failed to load user for address {}",userEmail));
LOG.debug("Laden des Nutzers für die Adresse {} fehlgeschlagen",userEmail,e);
return Map.of(ERROR,t("Laden des Nutzers für die Adresse {} fehlgeschlagen",userEmail));
}
return Map.of(SUCCESS,"Updated user permissions");
return Map.of(SUCCESS,"Nutzer-Berechtigungen aktualisiert");
}
public String handleGet(HttpServletRequest req, HttpServletResponse resp){
@ -95,8 +95,8 @@ public class Rest extends HttpServlet { @@ -95,8 +95,8 @@ public class Rest extends HttpServlet {
try {
json.put("users", (user.hashPermission(User.PERMISSION_ADMIN) ? User.loadAll() : List.of(user)).stream().map(User::safeMap).toList());
} catch (SQLException e) {
LOG.debug("Failed to load user list:",e);
json.put(ERROR,"failed to load user list");
LOG.debug("Laden der Nutzerliste fehlgeschlagen:",e);
json.put(ERROR,"Laden der Nutzerliste fehlgeschlagen");
}
break;
case LIST_EDITABLE:
@ -105,7 +105,7 @@ public class Rest extends HttpServlet { @@ -105,7 +105,7 @@ public class Rest extends HttpServlet {
case LIST_SUBSCRIBABLE:
json.put("lists", MailingList.subscribable(user).stream().map(MailingList::minimalMap).toList());
default:
json.put(ERROR,t("No handler for path '{}'!",path));
json.put(ERROR,t("Kein Handler für den Pfad '{}'!",path));
break;
}
} else {
@ -114,7 +114,7 @@ public class Rest extends HttpServlet { @@ -114,7 +114,7 @@ public class Rest extends HttpServlet {
json.put("lists", MailingList.subscribable().stream().map(MailingList::minimalMap).toList());
break;
default:
json.put(ERROR,"Not logged in!");
json.put(ERROR,"Nicht eingeloggt!");
}
}
try {
@ -122,7 +122,7 @@ public class Rest extends HttpServlet { @@ -122,7 +122,7 @@ public class Rest extends HttpServlet {
resp.getWriter().println(json.toJSONString());
return null;
} catch (IOException e) {
return t("Failed to handle request: {}",e.getMessage());
return t("Konnte Anfrage nicht verarbeiten: {}",e.getMessage());
}
}
@ -160,26 +160,26 @@ public class Rest extends HttpServlet { @@ -160,26 +160,26 @@ public class Rest extends HttpServlet {
case USER_ADD_PERMISSION:
if (user.hashPermission(User.PERMISSION_ADMIN)){
json.putAll(addPermission(userEmail,permissions));
} else json.put(ERROR,"You are not allowed to alter user permissions!");
} else json.put(ERROR,"Sie haben nicht die Berechtigung, um Berechtigungen zu ändern!");
break;
case USER_DROP_PERMISSION:
if (user.hashPermission(User.PERMISSION_ADMIN)){
json.putAll(dropPermission(userEmail,permissions));
} else json.put(ERROR,"You are not allowed to alter user permissions!");
} else json.put(ERROR,"Sie haben nicht die Berechtigung, um Berechtigungen zu ändern!");
break;
default:
json.put(ERROR,t("No handler for path '{}'!",path));
json.put(ERROR,t("Kein Handler für den Pfad '{}'!",path));
break;
}
} else {
json.put(ERROR,"Not logged in!");
json.put(ERROR,"Nicht eingeloggt!");
}
try {
resp.setContentType("application/json");
resp.getWriter().println(json.toJSONString());
return null;
} catch (IOException e) {
return t("Failed to handle request: {}",e.getMessage());
return t("Konnte Anfrage nicht verarbeiten: {}",e.getMessage());
}
}
@ -198,11 +198,11 @@ public class Rest extends HttpServlet { @@ -198,11 +198,11 @@ public class Rest extends HttpServlet {
.toList();
return Map.of(MEMBERS,members);
} catch (SQLException e) {
LOG.error("Failed to load member list: ",e);
return Map.of("error",t("Failed to load member list '{}'",listEmail));
LOG.error("Laden der Mitglieder-Liste fehlgeschlagen: ",e);
return Map.of("error",t("Laden der Mitglieder-Liste von '{}' fehlgeschlagen",listEmail));
}
}
return Map.of("error",t("You are not allowed to list members '{}'",listEmail));
return Map.of("error",t("Sie haben nicht die Berechtigng, um die Mitglieder von '{}' aufzulisten.",listEmail));
}
private Map enableList(String listEmail, User user, boolean enable) {
@ -210,9 +210,9 @@ public class Rest extends HttpServlet { @@ -210,9 +210,9 @@ public class Rest extends HttpServlet {
if (user.hashPermission(User.PERMISSION_ADMIN) || ListMember.listsOwnedBy(user).contains(listEmail)){
try {
MailingList.load(listEmail).enable(enable);
return Map.of(SUCCESS,t("Mailing list '{}' was {}!",listEmail,enable ? "enabled" : "disabled"));
return Map.of(SUCCESS,t("Mailing-List '{}' wurde {}!",listEmail,enable ? "aktiviert" : "inaktiviert"));
} catch (SQLException e) {
LOG.error("Failed to enable/disable mailing list: ",e);
LOG.error("Aktivieren/Inaktivieren der Mailing-Liste fehlgeschlagen: ",e);
return Map.of("error",t("Failed to update list '{}'",listEmail));
}
}

Loading…
Cancel
Save