diff options
| author | Mürsel Türk | 2020-07-11 22:18:00 +0200 |
|---|---|---|
| committer | Mürsel Türk | 2020-07-11 22:20:00 +0200 |
| commit | 897a623d8dec1ecc5a9c100e17737e386ad03630 (patch) | |
| tree | 6e469bcbff75f0d3b072db4cbd33e56cef1ce97b | |
| parent | [client] Update GraphicalCertHandler (diff) | |
| download | tutor-module-897a623d8dec1ecc5a9c100e17737e386ad03630.tar.gz tutor-module-897a623d8dec1ecc5a9c100e17737e386ad03630.tar.xz tutor-module-897a623d8dec1ecc5a9c100e17737e386ad03630.zip | |
[client] Add resource bundle files thrift
Added resource bundle files for the thrift classes.
Then updated these classes accordingly.
7 files changed, 301 insertions, 107 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/I18n.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/I18n.java index 782bd2a6..83c3c6cc 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/I18n.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/I18n.java @@ -16,6 +16,7 @@ public enum I18n { GUI("gui"), PAGE("page"), PAGE_LAYOUT("page_layout"), + THRIFT("thrift"), WINDOW("window"), WINDOW_LAYOUT("window_layout"), WIZARD("wizard"); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java index 4267ea31..07146ead 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java @@ -10,6 +10,7 @@ import org.openslx.bwlp.thrift.iface.TAuthorizationException; import org.openslx.dozmod.Config; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.Gui.GuiCallable; +import org.openslx.dozmod.gui.helper.I18n; import org.openslx.dozmod.gui.helper.MessageType; import org.openslx.thrifthelper.ThriftManager.ErrorCallback; @@ -44,9 +45,9 @@ public class GuiErrorCallback implements ErrorCallback { return Gui.syncExec(new GuiCallable<Boolean>() { @Override public Boolean run() { - if (Gui.showMessageBox(parent, "Ungültiges Sitzungstoken oder fehlerhafte Authentifizierung am " + serverString + "!" + - //"\n" + errMsg + "\n" + - "\nBitte starten Sie das Programm neu. Jetzt beenden?", MessageType.ERROR_RETRY, LOGGER, t)) { + if (Gui.showMessageBox(parent, + I18n.THRIFT.getString("GuiErrorCallback.Message.error.notAuthenticatedOrInvalidToken", + serverString), MessageType.ERROR_RETRY, LOGGER, t)) { // user confirmed exit Config.saveCurrentSession("", "", ""); Gui.exit(0); @@ -64,11 +65,11 @@ public class GuiErrorCallback implements ErrorCallback { public Boolean run() { String errMsg = null; if (tex != null) { - errMsg = " (Fehler " + tex.getType() + ")"; + errMsg = I18n.THRIFT.getString("GuiErrorCallback.thriftError.String.errMsg", tex.getType()); } - return Gui.showMessageBox(parent, "Die Kommunikation mit " + serverString + " ist" - + " gestört. Der Aufruf der Funktion " + method + " ist fehlgeschlagen" + errMsg - + ".\n\n" + "Möchten Sie den Aufruf wiederholen?", MessageType.ERROR_RETRY, LOGGER, t); + return Gui.showMessageBox(parent, + I18n.THRIFT.getString("GuiErrorCallback.Message.error.transportException", + serverString, method, errMsg), MessageType.ERROR_RETRY, LOGGER, t); } }); } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java index 11feba74..0bf1bfcb 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java @@ -15,6 +15,7 @@ import org.openslx.bwlp.thrift.iface.TInvocationException; import org.openslx.bwlp.thrift.iface.TNotFoundException; import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.dozmod.gui.Gui; +import org.openslx.dozmod.gui.helper.I18n; import org.openslx.dozmod.thrift.ThriftActions.DeleteCallback; import org.openslx.dozmod.thrift.ThriftActions.ImageMetaCallback; import org.openslx.thrifthelper.ThriftManager; @@ -74,7 +75,8 @@ public class ImageLocalDetailsActions implements ImageDetailsActions { try { ThriftActions.writeImagePermissions(imageBaseId, customPermissions); } catch (TException e) { - ThriftError.showMessage(parent, LOGGER, e, "Could not write permissions"); + ThriftError.showMessage(parent, LOGGER, e, + I18n.THRIFT.getString("ImageLocalDetailsActions.Message.error.writeImagePermissionsFailed")); } } }); @@ -105,7 +107,8 @@ public class ImageLocalDetailsActions implements ImageDetailsActions { ThriftManager.getSatClient().setImageVersionVirtConfig(Session.getSatelliteToken(), imageVersionId, machineDescription); success = true; } catch (TException e) { - ThriftError.showMessage(parent, LOGGER, e, "Fehler beim Speichern der VM-Konfiguration!"); + ThriftError.showMessage(parent, LOGGER, e, + I18n.THRIFT.getString("ImageLocalDetailsActions.Message.error.setVirtualizerConfigFailed")); } Gui.asyncExec(new Runnable() { @Override diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java index 66f9efe9..4c11002d 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java @@ -46,6 +46,7 @@ import org.openslx.dozmod.filetransfer.TransferEventListener; import org.openslx.dozmod.gui.GraphicalCertHandler; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.MainWindow; +import org.openslx.dozmod.gui.helper.I18n; import org.openslx.dozmod.gui.helper.MessageType; import org.openslx.dozmod.gui.helper.QFileChooser; import org.openslx.dozmod.gui.window.SatelliteListWindow; @@ -95,9 +96,8 @@ public class ThriftActions { long remoteVersion = -1; if (interactive && !forceCustomSatellite && (data.satellites == null || data.satellites.isEmpty())) { - Gui.asyncMessageBox("Login erfolgreich, aber es wurde kein Satellitenserver gefunden.\n" - + " Bitte geben Sie die Adresse Ihres Servers manuell an.", MessageType.ERROR, LOGGER, - null); + Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.satellitesNullOrEmpty"), + MessageType.ERROR, LOGGER, null); } do { @@ -147,10 +147,8 @@ public class ThriftActions { } } if (sat.addressList == null || sat.addressList.isEmpty()) { - Gui.asyncMessageBox( - "Login erfolgreich, aber für den ausgewählten Satellitenserver ist\n" - + "keine Adresse hinterlegt. Kann nicht verbinden.", MessageType.ERROR, - LOGGER, null); + Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.addressListNullOrEmpty"), + MessageType.ERROR, LOGGER, null); continue; } address = sat.addressList.get(0); @@ -176,9 +174,7 @@ public class ThriftActions { if (client == null || remoteVersion == -1) { if (interactive) { - Gui.asyncMessageBox( - "Authentifizierung erfolgreich, die Verbindung zum Satellitenserver ist jedoch nicht möglich.\n\n" - + "Möglicherweise ist der Server nicht verfügbar, oder die Netzwerkverbindung gestört.", + Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.couldNotGetNewClient"), MessageType.ERROR, null, null); if (data.satellites.size() == 1) { return false; @@ -190,10 +186,8 @@ public class ThriftActions { if (remoteVersion < Version.MIN_VERSION || remoteVersion > Version.VERSION) { if (interactive) { - Gui.asyncMessageBox("Das von Ihnen verwendete Dozentenmodul ist nicht mit dem" - + " gewählten Satellitenserver kompatibel.\n" + "Ihre Version: " - + Version.VERSION + "\n" + "Satelliten-Version: " + remoteVersion, - MessageType.ERROR, LOGGER, null); + Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.versionNotCompatible", + Version.VERSION, remoteVersion), MessageType.ERROR, LOGGER, null); continue; } return false; @@ -205,21 +199,19 @@ public class ThriftActions { } catch (TAuthorizationException e) { if (interactive) { ThriftError.showMessage(window, LOGGER, e, - "Authentifizierung erfolgreich, der Satellitenserver verweigert jedoch die Verbindung.\n" - + "Versuchen Sie, sich erneut anzumelden.\n"); + I18n.THRIFT.getString("ThriftActions.Message.error.authorizationException")); } return false; } catch (TException e) { if (interactive) { ThriftError.showMessage(window, LOGGER, e, - "Authentifizierung erfolgreich, bei der Kommunikation mit" - + " dem Satellitenserver trat jedoch ein interner Fehler auf."); + I18n.THRIFT.getString("ThriftActions.Message.error.sessionInternalError")); continue; } return false; } catch (Exception e) { if (interactive) { - Gui.asyncMessageBox("Unbekannter Fehler beim Verbinden mit dem Satellitenserver.", + Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.sessionUnknownError"), MessageType.ERROR, LOGGER, e); continue; } @@ -268,10 +260,11 @@ public class ThriftActions { try { uuid = ThriftManager.getSatClient().createImage(Session.getSatelliteToken(), name); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Erstellen der VM fehlgeschlagen"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.createImageFailed")); } catch (Exception e) { - Gui.showMessageBox(frame, "Unbekannter Fehler beim Erstellen der VM", MessageType.ERROR, LOGGER, - e); + Gui.showMessageBox(frame, I18n.THRIFT.getString("ThriftActions.Message.error.createImageUnknownError"), + MessageType.ERROR, LOGGER, e); } return uuid; } @@ -371,7 +364,7 @@ public class ThriftActions { final String virtualizerId, final int osId, final long imageSize, final DownloadCallback callback) { // TODO: Return value? Callback? QFileChooser fc = new QFileChooser(Config.getDownloadPath(), true); - fc.setDialogTitle("Bitte wählen Sie einen Speicherort"); + fc.setDialogTitle(I18n.THRIFT.getString("ThriftActions.FileChooser.fc.dialogTitle")); int action = fc.showSaveDialog(frame); File selected = fc.getSelectedFile(); if (action != JFileChooser.APPROVE_OPTION || selected == null) { @@ -385,9 +378,8 @@ public class ThriftActions { null) + ".part"); if (destDir.exists()) { - boolean ret = Gui.showMessageBox(frame, "Verzeichnis '" + destDir.getAbsolutePath() - + "' existiert bereits, wollen Sie die VM darin überschreiben?", - MessageType.QUESTION_YESNO, LOGGER, null); + boolean ret = Gui.showMessageBox(frame, I18n.THRIFT.getString("ThriftActions.Message.yesNo.destDirExists", + destDir.getAbsolutePath()), MessageType.QUESTION_YESNO, LOGGER, null); if (!ret) { // user aborted if (callback != null) @@ -396,8 +388,8 @@ public class ThriftActions { } // delete it if (!tmpDiskFile.delete() && tmpDiskFile.exists()) { - Gui.showMessageBox(frame, "Datei konnte nicht überschrieben werden!", MessageType.ERROR, - LOGGER, null); + Gui.showMessageBox(frame, I18n.THRIFT.getString("ThriftActions.Message.error.couldNotDeleteDiskFile"), + MessageType.ERROR, LOGGER, null); if (callback != null) callback.downloadInitialized(false); return; @@ -408,10 +400,9 @@ public class ThriftActions { // Check the free space on disk if (destDir.getUsableSpace() < imageSize + SIZE_CHECK_EXTRA_DL) { - Gui.showMessageBox(frame, "Nicht genügend Speicherplatz im ausgewählten Verzeichnis verfügbar.\n" - + "Brauche: " + FormatHelper.bytes(imageSize + SIZE_CHECK_EXTRA_DL, false) + "\n" - + "Habe: " + FormatHelper.bytes(destDir.getUsableSpace(), false), MessageType.ERROR, - LOGGER, null); + Gui.showMessageBox(frame, I18n.THRIFT.getString("ThriftActions.Message.error.destDirHasNotEnoughFreeSpace", + FormatHelper.bytes(imageSize + SIZE_CHECK_EXTRA_DL, false), + FormatHelper.bytes(destDir.getUsableSpace(), false)), MessageType.ERROR, LOGGER, null); if (callback != null) callback.downloadInitialized(false); return; @@ -447,7 +438,8 @@ public class ThriftActions { } if (transInf == null) { // both download request failed, show user feedback - ThriftError.showMessage(frame, LOGGER, transEx, "Die Download-Anfrage ist gescheitert"); + ThriftError.showMessage(frame, LOGGER, transEx, + I18n.THRIFT.getString("ThriftActions.Message.error.downloadRequestFailed")); if (callback != null) callback.downloadInitialized(false); return; @@ -459,8 +451,7 @@ public class ThriftActions { dlTask = new DownloadTask(fTransHost, transInf.getPlainPort(), transInf.getToken(), tmpDiskFile, imageSize, null); } catch (FileNotFoundException e) { - Gui.asyncMessageBox( - "Konnte Download nicht vorbereiten: Der gewählte Zielort ist nicht beschreibbar", + Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.destinationNotWritable"), MessageType.ERROR, LOGGER, e); if (callback != null) callback.downloadInitialized(false); @@ -485,15 +476,10 @@ public class ThriftActions { ext = diskImage.format.extension; } if (diskImage.isCompressed) { - String msg = "<html>Die heruntergeladene VM '" + imageName + "' ist ein komprimiertes " - + "Abbild.<br>Sie müssen das Abbild dekomprimieren, bevor Sie es verändern " - + "können.<br> Die VM wird lokal voraussichtlich nicht startfähig sein!" - + "<br><br>Bitte lesen Sie die Hinweise unter " - + "<a href=\"" + Branding.getServiceFAQWebsite() + "\">" - + "VMDK Disk Types</a>"; - - Gui.asyncMessageBox(msg, MessageType.WARNING, null, - null); + Gui.asyncMessageBox( + I18n.THRIFT.getString("ThriftActions.Message.warning.diskImageCompressed", + imageName, Branding.getServiceFAQWebsite()), + MessageType.WARNING, null, null); } } File destImage = new File(destDir.getAbsolutePath(), VmWrapper.generateFilename( @@ -506,9 +492,7 @@ public class ThriftActions { VmWrapper.wrapVm(destImage, imageName, fTransInf.getMachineDescription(), virtualizerId, osId, diskImage); } catch (MetaDataMissingException | IOException e) { - Gui.asyncMessageBox( - "Zur heruntergeladenen VM konnte keine vmx-Datei angelegt werden." - + "\nSie können versuchen, das Abbild manuell in den VMWare-Player zu importieren.", + Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.warning.couldNotWrapVM"), MessageType.WARNING, LOGGER, e); } } @@ -577,7 +561,8 @@ public class ThriftActions { try { details = ThriftManager.getSatClient().getImageDetails(Session.getSatelliteToken(), imageBaseId); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Lesen der Metadaten"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.getImageDetailsFailed")); } return details; } @@ -669,7 +654,8 @@ public class ThriftActions { permissionMap = ThriftManager.getSatClient().getImagePermissions(Session.getSatelliteToken(), imageBaseId); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Lesen der Metadaten"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.getImagePermissionsFailed")); } return permissionMap; } @@ -687,7 +673,8 @@ public class ThriftActions { ThriftManager.getSatClient().setImageOwner(Session.getSatelliteToken(), lectureId, newOwner.getUserId()); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Übertragen der Besitzrechte"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.setImageOwnerFailed")); return false; } return true; @@ -747,12 +734,12 @@ public class ThriftActions { } catch (TException e) { ThriftError.showMessage(frame, LOGGER, e, - "Fehler beim Holen der Versionen/Veranstaltung zu folgender VM: " + imageBaseId); + I18n.THRIFT.getString("ThriftActions.Message.error.couldNotGetImageBase", imageBaseId)); return; } String questionText; if (versionToBeDeleted != null && !versionToBeDeleted.isEmpty()) { - questionText = "Die VM \"" + details.getImageName() + "\" hat folgende gültige Versionen:\n"; + questionText = I18n.THRIFT.getString("ThriftActions.deleteImageBase.String.questionText.0", details.getImageName()); for (ImageVersionDetails version : versionToBeDeleted) { questionText += version.getVersionId() + "\n"; } @@ -761,19 +748,20 @@ public class ThriftActions { questionText = ""; } if (lecturesToBeDeleted != null && !lecturesToBeDeleted.isEmpty()) { - questionText += "Folgende Veranstaltungen sind mit dieser VM verknüpft: \n"; + questionText += I18n.THRIFT.getString("ThriftActions.deleteImageBase.String.questionText.1"); for (LectureSummary lecture : lecturesToBeDeleted) { questionText += lecture.getLectureName() + "\n"; } questionText += "\n"; } - questionText += "Wollen Sie wirklich mit dem Löschen fortfahren?"; + questionText += I18n.THRIFT.getString("ThriftActions.deleteImageBase.String.questionText.2"); if (!userConfirmed(frame, questionText)) return; try { ThriftManager.getSatClient().deleteImageBase(Session.getSatelliteToken(), imageBaseId); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Konnte VM-Daten nicht löschen!"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.couldNotDeleteImageBase")); } } @@ -801,7 +789,8 @@ public class ThriftActions { // fetch lectures lectureList = ThriftManager.getSatClient().getLectureList(Session.getSatelliteToken(), 100); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Holen der Liste der Veranstaltungen"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.couldNotGetImageVersion")); if (callback != null) callback.isDeleted(success); return; @@ -814,17 +803,17 @@ public class ThriftActions { for (LectureSummary lecture : lectureList) { if (versionId.equals(lecture.getImageVersionId())) { if (!matches) - questionText = "Diese Version ist zu folgende Veranstaltungen verknüpft:\n"; + questionText = I18n.THRIFT.getString("ThriftActions.deleteImageVersion.String.questionText.0"); matches = true; questionText += lecture.getLectureName() + "\n"; } } if (matches) - questionText += "\nWollen Sie diese Version samt Veranstaltungen löschen?\n"; + questionText += I18n.THRIFT.getString("ThriftActions.deleteImageVersion.String.questionText.1"); } if (!matches) - questionText = "Wollen Sie die VM-Image-Version vom " - + FormatHelper.shortDate(version.createTime) + " Uhr wirklich löschen?"; + questionText = I18n.THRIFT.getString("ThriftActions.deleteImageVersion.String.questionText.2", + FormatHelper.shortDate(version.createTime)); if (!userConfirmed(frame, questionText)) return; @@ -833,7 +822,8 @@ public class ThriftActions { LOGGER.info("Deleted version '" + versionId + "'."); success = true; } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Löschen der Version"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.couldNotDeleteImageVersion")); if (callback != null) callback.isDeleted(success); return; @@ -868,7 +858,8 @@ public class ThriftActions { // push to sat uuid = ThriftManager.getSatClient().createLecture(Session.getSatelliteToken(), meta); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Failed to create lecture"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.createLectureFailed")); } return uuid; } @@ -887,7 +878,8 @@ public class ThriftActions { ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), lectureId, permissions); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Failed to write lecture permissions"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.writeLecturePermissionsFailed")); return false; } return true; @@ -952,7 +944,8 @@ public class ThriftActions { try { lecture = ThriftManager.getSatClient().getLectureDetails(Session.getSatelliteToken(), lectureId); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Konnte Veranstaltungdaten nicht abrufen"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.getLectureDetailsFailed")); } return lecture; } @@ -970,7 +963,8 @@ public class ThriftActions { try { ThriftManager.getSatClient().updateLecture(Session.getSatelliteToken(), lectureId, lectureWrite); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Updaten der Veranstaltung"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.updateLectureFailed")); return false; } return true; @@ -994,7 +988,8 @@ public class ThriftActions { permissions = ThriftManager.getSatClient().getLecturePermissions(Session.getSatelliteToken(), lectureId); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Konnte Veranstaltungdaten nicht abrufen"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.getLecturePermissionsFailed")); } return permissions; @@ -1013,7 +1008,8 @@ public class ThriftActions { ThriftManager.getSatClient().setLectureOwner(Session.getSatelliteToken(), lectureId, newOwner.getUserId()); } catch (TException e) { - ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Übertragen der Besitzrechte"); + ThriftError.showMessage(frame, LOGGER, e, + I18n.THRIFT.getString("ThriftActions.Message.error.setLectureOwnerFailed")); return false; } return true; @@ -1043,8 +1039,9 @@ public class ThriftActions { final DeleteLectureCallback callback) { if (lectures == null) return; - String messageText = lectures.size() == 1 ? "Wollen Sie diese Veranstaltung wirklich löschen?" - : "Wollen Sie die " + lectures.size() + " Veranstaltungen wirklich löschen?"; + String messageText = lectures.size() == 1 + ? I18n.THRIFT.getString("ThriftActions.deleteLecture.String.messageText.0") + : I18n.THRIFT.getString("ThriftActions.deleteLecture.String.messageText.1", lectures.size()); if (!userConfirmed(frame, messageText)) return; diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java index 773b941f..dd69d55c 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java @@ -14,25 +14,29 @@ import org.openslx.bwlp.thrift.iface.TInvocationException; import org.openslx.bwlp.thrift.iface.TNotFoundException; import org.openslx.bwlp.thrift.iface.TTransferRejectedException; import org.openslx.dozmod.gui.Gui; +import org.openslx.dozmod.gui.helper.I18n; import org.openslx.dozmod.gui.helper.MessageType; public class ThriftError { public static void showMessage(final Component parent, Logger logger, TException ex, String messageText) { if (ex instanceof TNotFoundException) { - messageText += "\n\nNicht gefunden"; + messageText += I18n.THRIFT.getString("ThriftError.Message.error.notFoundException"); } else if (ex instanceof TAuthorizationException) { String reason = getString(((TAuthorizationException) ex).getNumber()); - messageText += "\n\nZugriff verweigert: " + reason + "\n" + ex.getMessage(); + messageText += I18n.THRIFT.getString("ThriftError.Message.error.authorizationException", + reason, ex.getMessage()); } else if (ex instanceof TInvocationException) { - messageText += "\n\nDer Funktionsaufruf konnte nicht durchgeführt werden: " - + getString(((TInvocationException) ex).getNumber()) + "\n" + ex.getMessage(); + messageText += I18n.THRIFT.getString("ThriftError.Message.error.invocationException", + getString(((TInvocationException) ex).getNumber()), ex.getMessage()); } else if (ex instanceof TInvalidDateParam) { - messageText += "\n\nEin angegebenes Datum ist ungültig:\n" + ex.getMessage(); + messageText += I18n.THRIFT.getString("ThriftError.Message.error.invalidDateParam", ex.getMessage()); } else if (ex instanceof TTransferRejectedException) { - messageText += "\n\nDie Transferanfrage wurde vom Server abgelehnt:\n" + ex.getMessage(); + messageText += I18n.THRIFT.getString("ThriftError.Message.error.transferRejectedException", + ex.getMessage()); } else { - messageText += "\n\nUnerwartete Ausnahme " + ex.getClass().getSimpleName() + " ist aufgetreten."; + messageText += I18n.THRIFT.getString("ThriftError.Message.error.unexpectedException", + ex.getClass().getSimpleName()); } if (logger != null) { logger.warn("A thrift call raised an exception", ex); @@ -52,55 +56,55 @@ public class ThriftError { private static String getString(InvocationError error) { if (error == null) - return "Interner serverseitiger Fehler"; + return I18n.THRIFT.getString("ThriftError.InvocationError.null"); switch (error) { case INTERNAL_SERVER_ERROR: - return "Interner serverseitiger Fehler"; + return I18n.THRIFT.getString("ThriftError.InvocationError.internalServerError"); case INVALID_DATA: - return "Ein Parameter hat einen ungültigen Wert"; + return I18n.THRIFT.getString("ThriftError.InvocationError.invalidData"); case INVALID_SHARE_MODE: - return "Ungültiger Share-Mode"; + return I18n.THRIFT.getString("ThriftError.InvocationError.invalidShareMode"); case MISSING_DATA: - return "Ein Parameter fehlt (null?)"; + return I18n.THRIFT.getString("ThriftError.InvocationError.missingData"); case UNKNOWN_IMAGE: - return "Unbekannte VM/Image"; + return I18n.THRIFT.getString("ThriftError.InvocationError.unknownImage"); case UNKNOWN_LECTURE: - return "Unbekannte Veranstaltung"; + return I18n.THRIFT.getString("ThriftError.InvocationError.unknownLecture"); case UNKNOWN_USER: - return "Unbekannter Benutzer"; + return I18n.THRIFT.getString("ThriftError.InvocationError.unknownUser"); default: - return "Unbekannter Fehlercode: " + error.toString(); + return I18n.THRIFT.getString("ThriftError.InvocationError.default", error.toString()); } } public static String getString(AuthorizationError error) { if (error == null) - return "(AuthorizationError=null)"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.null"); switch (error) { case ACCOUNT_SUSPENDED: - return "Das Benutzerkonto ist gesperrt"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.accountSuspended"); case BANNED_NETWORK: - return "Das Netzwerk, aus dem Sie operieren, ist gesperrt"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.bannedNetwork"); case CHALLENGE_FAILED: - return "Challenge fehlgeschlagen"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.challengeFailed"); case GENERIC_ERROR: - return "Generischer Fehler"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.genericError"); case INVALID_CREDENTIALS: - return "Ungültige Zugangsdaten\nStellen Sie sicher, dass Benutzername und Passwort korrekt sind"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.invalidCredentials"); case INVALID_KEY: - return "Ungültiger Schlüssel"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.invalidKey"); case INVALID_ORGANIZATION: - return "Ungültige oder unbekannte Organisation"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.invalidOrganization"); case INVALID_TOKEN: - return "Ungültiges Sitzungstoken"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.invalidToken"); case NOT_AUTHENTICATED: - return "Nicht authentifiziert"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.notAuthenticated"); case NO_PERMISSION: - return "Keine ausreichenden Berechtigungen"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.noPermission"); case ORGANIZATION_SUSPENDED: - return "Ihre zugehörige Organisation ist gesperrt"; + return I18n.THRIFT.getString("ThriftError.AuthorizationError.organizationSuspended"); default: - return "Unbekannter Fehlercode: " + error.toString(); + return I18n.THRIFT.getString("ThriftError.AuthorizationError.default", error.toString()); } } diff --git a/dozentenmodul/src/main/properties/i18n/thrift.properties b/dozentenmodul/src/main/properties/i18n/thrift.properties new file mode 100644 index 00000000..345cbd9b --- /dev/null +++ b/dozentenmodul/src/main/properties/i18n/thrift.properties @@ -0,0 +1,94 @@ +# GuiErrorCallback +GuiErrorCallback.Message.error.notAuthenticatedOrInvalidToken=Ungültiges Sitzungstoken oder fehlerhafte \ + Authentifizierung am {0}!\nBitte starten Sie das Programm neu. Jetzt beenden? +GuiErrorCallback.thriftError.String.errMsg=(Fehler {0}) +GuiErrorCallback.Message.error.transportException=Die Kommunikation mit {0} ist gestört. \ + Der Aufruf der Funktion {1} ist fehlgeschlagen {2}.\n\n\ + Möchten Sie den Aufruf wiederholen? + +# ImageLocalDetailsActions +ImageLocalDetailsActions.Message.error.writeImagePermissionsFailed=Could not write permissions +ImageLocalDetailsActions.Message.error.setVirtualizerConfigFailed=Fehler beim Speichern der VM-Konfiguration! + +# ThriftActions +ThriftActions.Message.error.satellitesNullOrEmpty=Login erfolgreich, aber es wurde kein Satellitenserver gefunden.\n\ + Bitte geben Sie die Adresse Ihres Servers manuell an. +ThriftActions.Message.error.addressListNullOrEmpty=Login erfolgreich, aber für den ausgewählten Satellitenserver ist\n\ + keine Adresse hinterlegt. Kann nicht verbinden. +ThriftActions.Message.error.couldNotGetNewClient=Authentifizierung erfolgreich, die Verbindung zum Satellitenserver \ + ist jedoch nicht möglich.\n\nMöglicherweise ist der Server nicht verfügbar, oder die Netzwerkverbindung gestört. +ThriftActions.Message.error.versionNotCompatible=Das von Ihnen verwendete Dozentenmodul ist nicht mit dem \ + gewählten Satellitenserver kompatibel.\nIhre Version: {0}\nSatelliten-Version: {1} +ThriftActions.Message.error.authorizationException=Authentifizierung erfolgreich, der Satellitenserver \ + verweigert jedoch die Verbindung.\nVersuchen Sie, sich erneut anzumelden.\n +ThriftActions.Message.error.sessionInternalError=Authentifizierung erfolgreich, bei der Kommunikation mit \ + dem Satellitenserver trat jedoch ein interner Fehler auf. +ThriftActions.Message.error.sessionUnknownError=Unbekannter Fehler beim Verbinden mit dem Satellitenserver. +ThriftActions.Message.error.createImageFailed=Erstellen der VM fehlgeschlagen +ThriftActions.Message.error.createImageUnknownError=Unbekannter Fehler beim Erstellen der VM +ThriftActions.FileChooser.fc.dialogTitle=Bitte wählen Sie einen Speicherort +ThriftActions.Message.yesNo.destDirExists=Verzeichnis ''{0}'' existiert bereits, wollen Sie die VM darin überschreiben? +ThriftActions.Message.error.couldNotDeleteDiskFile=Datei konnte nicht überschrieben werden! +ThriftActions.Message.error.destDirHasNotEnoughFreeSpace=Nicht genügend Speicherplatz im ausgewählten Verzeichnis \ + verfügbar.\nBrauche: {0}\nHabe: {1} +ThriftActions.Message.error.downloadRequestFailed=Die Download-Anfrage ist gescheitert +ThriftActions.Message.error.destinationNotWritable=Konnte Download nicht vorbereiten: Der gewählte Zielort \ + ist nicht beschreibbar +ThriftActions.Message.warning.diskImageCompressed=<html>Die heruntergeladene VM ''{0}'' ist ein komprimiertes \ + Abbild.<br>Sie müssen das Abbild dekomprimieren, bevor Sie es verändern können.<br>Die VM wird lokal \ + voraussichtlich nicht startfähig sein!<br><br>Bitte lesen Sie die Hinweise unter <a href="{1}">VMDK Disk Types</a> +ThriftActions.Message.warning.couldNotWrapVM=Zur heruntergeladenen VM konnte keine vmx-Datei angelegt werden.\n\ + Sie können versuchen, das Abbild manuell in den VMWare-Player zu importieren. +ThriftActions.Message.error.getImageDetailsFailed=Fehler beim Lesen der Metadaten +ThriftActions.Message.error.getImagePermissionsFailed=Fehler beim Lesen der Metadaten +ThriftActions.Message.error.setImageOwnerFailed=Fehler beim Übertragen der Besitzrechte +ThriftActions.Message.error.couldNotGetImageBase=Fehler beim Holen der Versionen/Veranstaltung zu \ + folgender VM: {0} +ThriftActions.deleteImageBase.String.questionText.0=Die VM "{0}" hat folgende gültige Versionen:\n +ThriftActions.deleteImageBase.String.questionText.1=Folgende Veranstaltungen sind mit dieser VM verknüpft: \n +ThriftActions.deleteImageBase.String.questionText.2=Wollen Sie wirklich mit dem Löschen fortfahren? +ThriftActions.Message.error.couldNotDeleteImageBase=Konnte VM-Daten nicht löschen! +ThriftActions.Message.error.couldNotGetImageVersion=Fehler beim Holen der Liste der Veranstaltungen +ThriftActions.deleteImageVersion.String.questionText.0=Diese Version ist zu folgende Veranstaltungen verknüpft:\n +ThriftActions.deleteImageVersion.String.questionText.1=\nWollen Sie diese Version samt Veranstaltungen löschen?\n +ThriftActions.deleteImageVersion.String.questionText.2=Wollen Sie die VM-Image-Version vom {0} Uhr wirklich löschen? +ThriftActions.Message.error.couldNotDeleteImageVersion=Fehler beim Löschen der Version +ThriftActions.Message.error.createLectureFailed=Failed to create lecture +ThriftActions.Message.error.writeLecturePermissionsFailed=Failed to write lecture permissions +ThriftActions.Message.error.getLectureDetailsFailed=Konnte Veranstaltungdaten nicht abrufen +ThriftActions.Message.error.updateLectureFailed=Fehler beim Updaten der Veranstaltung +ThriftActions.Message.error.getLecturePermissionsFailed=Konnte Veranstaltungdaten nicht abrufen +ThriftActions.Message.error.setLectureOwnerFailed=Fehler beim Übertragen der Besitzrechte +ThriftActions.deleteLecture.String.messageText.0=Wollen Sie diese Veranstaltung wirklich löschen? +ThriftActions.deleteLecture.String.messageText.1=Wollen Sie die {0} Veranstaltungen wirklich löschen? + +# ThriftError +ThriftError.Message.error.notFoundException=\n\nNicht gefunden +ThriftError.Message.error.authorizationException=\n\nZugriff verweigert: {0}\n{1} +ThriftError.Message.error.invocationException=\n\nDer Funktionsaufruf konnte nicht durchgeführt werden: {0}\n{1} +ThriftError.Message.error.invalidDateParam=\n\nEin angegebenes Datum ist ungültig:\n{0} +ThriftError.Message.error.transferRejectedException=\n\nDie Transferanfrage wurde vom Server abgelehnt:\n{0} +ThriftError.Message.error.unexpectedException=\n\nUnerwartete Ausnahme {0} ist aufgetreten. +ThriftError.InvocationError.null=Interner serverseitiger Fehler +ThriftError.InvocationError.internalServerError=Interner serverseitiger Fehler +ThriftError.InvocationError.invalidData=Ein Parameter hat einen ungültigen Wert +ThriftError.InvocationError.invalidShareMode=Ungültiger Share-Mode +ThriftError.InvocationError.missingData=Ein Parameter fehlt (null?) +ThriftError.InvocationError.unknownImage=Unbekannte VM/Image +ThriftError.InvocationError.unknownLecture=Unbekannte Veranstaltung +ThriftError.InvocationError.unknownUser=Unbekannter Benutzer +ThriftError.InvocationError.default=Unbekannter Fehlercode: {0} +ThriftError.AuthorizationError.null=(AuthorizationError=null) +ThriftError.AuthorizationError.accountSuspended=Das Benutzerkonto ist gesperrt +ThriftError.AuthorizationError.bannedNetwork=Das Netzwerk, aus dem Sie operieren, ist gesperrt +ThriftError.AuthorizationError.challengeFailed=Challenge fehlgeschlagen +ThriftError.AuthorizationError.genericError=Generischer Fehler +ThriftError.AuthorizationError.invalidCredentials=Ungültige Zugangsdaten\nStellen Sie sicher, dass Benutzername \ + und Passwort korrekt sind +ThriftError.AuthorizationError.invalidKey=Ungültiger Schlüssel +ThriftError.AuthorizationError.invalidOrganization=Ungültige oder unbekannte Organisation +ThriftError.AuthorizationError.invalidToken=Ungültiges Sitzungstoken +ThriftError.AuthorizationError.notAuthenticated=Nicht authentifiziert +ThriftError.AuthorizationError.noPermission=Keine ausreichenden Berechtigungen +ThriftError.AuthorizationError.organizationSuspended=Ihre zugehörige Organisation ist gesperrt +ThriftError.AuthorizationError.default=Unbekannter Fehlercode: {0}
\ No newline at end of file diff --git a/dozentenmodul/src/main/properties/i18n/thrift_en_US.properties b/dozentenmodul/src/main/properties/i18n/thrift_en_US.properties new file mode 100644 index 00000000..3ae5841e --- /dev/null +++ b/dozentenmodul/src/main/properties/i18n/thrift_en_US.properties @@ -0,0 +1,94 @@ +# GuiErrorCallback +GuiErrorCallback.Message.error.notAuthenticatedOrInvalidToken=Invalid session token or failed \ + authentication on {0}!\nPlease restart the program. Exit now? +GuiErrorCallback.thriftError.String.errMsg=(Error {0}) +GuiErrorCallback.Message.error.transportException=The communication with {0} is interrupted. \ + Calling the function {1} is failed {2}.\n\n\ + Would you like to retry the call? + +# ImageLocalDetailsActions +ImageLocalDetailsActions.Message.error.writeImagePermissionsFailed=Could not write permissions +ImageLocalDetailsActions.Message.error.setVirtualizerConfigFailed=Error while saving the VM configuration! + +# ThriftActions +ThriftActions.Message.error.satellitesNullOrEmpty=Login successful, but no satellite server was found.\n\ + Please enter the address of your server manually. +ThriftActions.Message.error.addressListNullOrEmpty=Login successful, but no address is stored for the\n\ + selected satellite server. Unable to connect. +ThriftActions.Message.error.couldNotGetNewClient=Authentication successful, but connection to the satellite server \ + is not possible.\n\nThe server may not be available or the network connection may be down. +ThriftActions.Message.error.versionNotCompatible=The lecturer module you are using is not \ + compatible with the selected satellite server.\nYour version: {0}\nSatellite version: {1} +ThriftActions.Message.error.authorizationException=Authentication successful, but the satellite server \ + refuses the connection.\nTry to login again.\n +ThriftActions.Message.error.sessionInternalError=Authentication successful, but an internal error \ + occurred during communication with the satellite server. +ThriftActions.Message.error.sessionUnknownError=Unknown error while connecting to the satellite server. +ThriftActions.Message.error.createImageFailed=Failed to create the VM +ThriftActions.Message.error.createImageUnknownError=Unknown error while creating the VM +ThriftActions.FileChooser.fc.dialogTitle=Please choose a storage location +ThriftActions.Message.yesNo.destDirExists=Directory ''{0}'' already exists, do you want to overwrite the VM in it? +ThriftActions.Message.error.couldNotDeleteDiskFile=File could not be overwritten! +ThriftActions.Message.error.destDirHasNotEnoughFreeSpace=Not enough space available in the selected \ + directory.\nNeeded: {0}\nHave: {1} +ThriftActions.Message.error.downloadRequestFailed=The download request failed +ThriftActions.Message.error.destinationNotWritable=Could not prepare download: The selected destination \ + is not writable +ThriftActions.Message.warning.diskImageCompressed=<html>The downloaded VM ''{0}'' is a compressed \ + image.<br>You must decompress the image before you can modify it.<br>The VM will \ + probably not be able to start locally!<br><br>Please read the notes under <a href="{1}">VMDK Disk Types</a> +ThriftActions.Message.warning.couldNotWrapVM=No vmx file could be created for the downloaded VM.\n\ + You can try to manually import the image into the VMWare player. +ThriftActions.Message.error.getImageDetailsFailed=Error while reading the metadata +ThriftActions.Message.error.getImagePermissionsFailed=Error while reading the metadata +ThriftActions.Message.error.setImageOwnerFailed=Error during transfer of ownership +ThriftActions.Message.error.couldNotGetImageBase=Error while fetching the versions/lecture for \ + the following VM: {0} +ThriftActions.deleteImageBase.String.questionText.0=The VM "{0}" has following valid versions:\n +ThriftActions.deleteImageBase.String.questionText.1=The following lectures are linked to this VM: \n +ThriftActions.deleteImageBase.String.questionText.2=Do you really want to continue with the delete operation? +ThriftActions.Message.error.couldNotDeleteImageBase=Could not delete VM data! +ThriftActions.Message.error.couldNotGetImageVersion=Error while fetching the list of lectures +ThriftActions.deleteImageVersion.String.questionText.0=This version is linked to the following lectures:\n +ThriftActions.deleteImageVersion.String.questionText.1=\nDo you want to delete this version including lectures?\n +ThriftActions.deleteImageVersion.String.questionText.2=Do you really want to delete the VM image version from {0}? +ThriftActions.Message.error.couldNotDeleteImageVersion=Error while deleting the version +ThriftActions.Message.error.createLectureFailed=Failed to create lecture +ThriftActions.Message.error.writeLecturePermissionsFailed=Failed to write lecture permissions +ThriftActions.Message.error.getLectureDetailsFailed=Could not retrieve lecture data +ThriftActions.Message.error.updateLectureFailed=Error while updating the lecture +ThriftActions.Message.error.getLecturePermissionsFailed=Could not retrieve lecture data +ThriftActions.Message.error.setLectureOwnerFailed=Error during transfer of ownership +ThriftActions.deleteLecture.String.messageText.0=Do you really want to delete this lecture? +ThriftActions.deleteLecture.String.messageText.1=Do you really want to delete the {0} lectures? + +# ThriftError +ThriftError.Message.error.notFoundException=\n\nNot found +ThriftError.Message.error.authorizationException=\n\nAccess denied: {0}\n{1} +ThriftError.Message.error.invocationException=\n\nThe function call could not be executed: {0}\n{1} +ThriftError.Message.error.invalidDateParam=\n\nA given date is invalid:\n{0} +ThriftError.Message.error.transferRejectedException=\n\nThe transfer request was rejected by the server:\n{0} +ThriftError.Message.error.unexpectedException=\n\nUnexpected exception {0} has occurred. +ThriftError.InvocationError.null=Internal server side error +ThriftError.InvocationError.internalServerError=Internal server side error +ThriftError.InvocationError.invalidData=A parameter has an invalid value +ThriftError.InvocationError.invalidShareMode=Invalid share mode +ThriftError.InvocationError.missingData=One parameter is missing (null?) +ThriftError.InvocationError.unknownImage=Unknown VM/Image +ThriftError.InvocationError.unknownLecture=Unknown lecture +ThriftError.InvocationError.unknownUser=Unknown user +ThriftError.InvocationError.default=Unknown error code: {0} +ThriftError.AuthorizationError.null=(AuthorizationError=null) +ThriftError.AuthorizationError.accountSuspended=The user account is suspended +ThriftError.AuthorizationError.bannedNetwork=The network you are operating on is blocked +ThriftError.AuthorizationError.challengeFailed=Challenge failed +ThriftError.AuthorizationError.genericError=Generic error +ThriftError.AuthorizationError.invalidCredentials=Invalid credentials\nMake sure that username and \ + password are correct +ThriftError.AuthorizationError.invalidKey=Invalid key +ThriftError.AuthorizationError.invalidOrganization=Invalid or unknown organization +ThriftError.AuthorizationError.invalidToken=Invalid session token +ThriftError.AuthorizationError.notAuthenticated=Not authenticated +ThriftError.AuthorizationError.noPermission=Not sufficient permissions +ThriftError.AuthorizationError.organizationSuspended=Your associated organization is suspended +ThriftError.AuthorizationError.default=Unknown error code: {0}
\ No newline at end of file |
