From f258eec269897c1d65480694f2e65dc8ce557a8a Mon Sep 17 00:00:00 2001 From: Robert Goldmann <deadlocker@gmx.de> Date: Mon, 21 Aug 2017 17:47:38 +0200 Subject: [PATCH] #120 - localized remaining controllers --- .../budgetmaster/logic/utils/Strings.java | 54 +++++++- .../budgetmaster/main/_de.properties | 48 +++++++ .../ui/controller/PaymentController.java | 12 +- .../ui/controller/ReportController.java | 68 ++++++---- .../ui/controller/SettingsController.java | 121 ++++++++++++++---- .../ui/controller/SplashScreenController.java | 45 ++++++- 6 files changed, 289 insertions(+), 59 deletions(-) diff --git a/src/de/deadlocker8/budgetmaster/logic/utils/Strings.java b/src/de/deadlocker8/budgetmaster/logic/utils/Strings.java index faf2fe9f3..f47f7f041 100644 --- a/src/de/deadlocker8/budgetmaster/logic/utils/Strings.java +++ b/src/de/deadlocker8/budgetmaster/logic/utils/Strings.java @@ -12,7 +12,9 @@ public class Strings //TITLE public static final String TITLE_INCOMES = "title.incomes"; + public static final String TITLE_INCOME = "title.income"; public static final String TITLE_PAYMENTS = "title.payments"; + public static final String TITLE_PAYMENT = "title.payment"; public static final String TITLE_CATEGORY = "title.category"; public static final String TITLE_CATEGORIES = "title.categories"; public static final String TITLE_CATEGORY_BUDGETS = "title.category.budgets"; @@ -24,10 +26,20 @@ public class Strings public static final String TITLE_CATEGORY_EDIT = "title.category.edit"; public static final String TITLE_CHART_EXPORT = "title.chart.export"; public static final String TITLE_MODAL = "title.modal"; + public static final String TITLE_PAYMENT_EDIT = "title.payment.edit"; + public static final String TITLE_PAYMENT_NEW = "title.payment.new"; + public static final String TITLE_FILTER = "title.filter"; + public static final String TITLE_REPORT_SAVE = "title.report.save"; + public static final String TITLE_DATABASE_EXPORT = "title.database.export"; + public static final String TITLE_DATABASE_IMPORT = "title.database.import"; //LOAD public static final String LOAD_CHARTS = "load.charts"; public static final String LOAD_DATA = "load.data"; + public static final String LOAD_REPORT = "load.report"; + public static final String LOAD_DATABASE_EXPORT = "load.database.export"; + public static final String LOAD_DATABASE_IMPORT = "load.database.import"; + public static final String LOAD_DATABASE_DELETE = "load.database.delete"; //MISC public static final String CATEGORY_NONE = "category.none"; @@ -41,6 +53,7 @@ public class Strings public static final String CANCEL = "cancel"; public static final String HOME_PLACEHOLDER = "home.placeholder"; public static final String HOME_BUDGET = "home.budget"; + public static final String PAYMENTS_PLACEHOLDER = "payments.placeholder"; //REPORT public static final String REPORT_POSITION = "report.position"; @@ -58,7 +71,8 @@ public class Strings public static final String REPORT_FOOTER_LEFT = "report.footer.left"; public static final String REPORT_FOOTER_CENTER = "report.footer.center"; public static final String REPORT_REPEATING_YES ="report.repeating.yes"; - public static final String REPORT_REPEATING_NO ="report.repeating.no"; + public static final String REPORT_REPEATING_NO ="report.repeating.no"; + public static final String REPORT_INITIAL_FILENAME ="report.initial.filename"; //MONTH_NAMES public static final String MONTH_JANUARY ="month.january"; @@ -76,6 +90,8 @@ public class Strings //NOTIFICATION public static final String NOTIFICATION_CHART_EXPORT = "notification.chart.export"; + public static final String NOTIFICATION_REPORT_SAVE = "notification.report.save"; + public static final String NOTIFICATION_SETTINGS_SAVE = "notification.settings.save"; //INFO public static final String INFO_TITLE_CATEGORY_DELETE = "info.title.category.delete"; @@ -90,7 +106,26 @@ public class Strings public static final String INFO_TEXT_CHART_EXPORT = "info.text.chart.export"; public static final String INFO_TEXT_CHART_EXPORT_OPEN_FOLDER = "info.text.chart.export.open.folder"; public static final String INFO_TEXT_CHART_EXPORT_OPEN_CHART = "info.text.chart.export.open.chart"; - + public static final String INFO_TITLE_REPORT_SAVE = "info.title.report.save"; + public static final String INFO_TEXT_REPORT_SAVE = "info.text.report.save"; + public static final String INFO_TEXT_REPORT_SAVE_OPEN_FOLDER = "info.text.report.save.open.folder"; + public static final String INFO_TEXT_REPORT_SAVE_OPEN_REPORT = "info.text.report.save.open.report"; + public static final String INFO_TITLE_DATABASE_EXPORT = "info.title.database.export"; + public static final String INFO_TEXT_DATABASE_EXPORT = "info.text.database.export"; + public static final String INFO_TITLE_DATABASE_IMPORT = "info.title.database.import"; + public static final String INFO_TEXT_DATABASE_IMPORT = "info.text.database.import"; + public static final String INFO_TITLE_DATABASE_IMPORT_DIALOG = "info.title.database.import.dialog"; + public static final String INFO_TEXT_DATABASE_IMPORT_DIALOG = "info.text.database.import.dialog"; + public static final String INFO_TEXT_DATABASE_IMPORT_DIALOG_DELETE = "info.text.database.import.dialog.delete"; + public static final String INFO_TEXT_DATABASE_IMPORT_DIALOG_APPEND = "info.text.database.import.dialog.append"; + public static final String INFO_TITLE_DATABASE_DELETE = "info.title.database.delete"; + public static final String INFO_HEADER_TEXT_DATABASE_DELETE = "info.header.text.database.delete"; + public static final String INFO_TEXT_DATABASE_DELETE = "info.text.database.delete"; + public static final String INFO_TITLE_WELCOME = "info.title.welcome"; + public static final String INFO_HEADER_TEXT_WELCOME = "info.header.text.welcome"; + public static final String INFO_TEXT_WELCOME_FIRST_START = "info.text.welcome.first.start"; + public static final String INFO_TEXT_WELCOME_COMPATIBILITY = "info.text.welcome.compatibility"; + //WARNING public static final String WARNING_ENDDATE_BEFORE_STARTDATE = "warning.enddate.before.startdate"; public static final String WARNING_EMPTY_WIDTH_IN_PIXELS = "warning.empty.width.in.pixels"; @@ -105,7 +140,14 @@ public class Strings public static final String WARNING_DESCRIPTION_CHARACTER_LIMIT_REACHED_150 = "warning.description.character.limit.reached.150"; public static final String WARNING_PAYMENT_AMOUNT = "warning.payment.amount"; public static final String WARNING_EMPTY_PAYMENT_DATE = "warning.empty.payment.date"; - public static final String WARNING_PAYMENT_REPEATING = "warning.payment.repeating"; + public static final String WARNING_PAYMENT_REPEATING = "warning.payment.repeating"; + public static final String WARNING_EMPTY_SECRET_CLIENT = " warning.empty.secret.client"; + public static final String WARNING_EMPTY_URL = "warning.empty.url"; + public static final String WARNING_EMPTY_SECRET_SERVER = "warning.empty.secret.server"; + public static final String WARNING_EMPTY_CURRENCY = "warning.empty.currency"; + public static final String WARNING_WRONG_VERIFICATION_CODE = "warning.wrong.verificationcode"; + public static final String WARNING_EMPTY_PASSWORD = "warning.empty.password"; + public static final String WARNING_WRONG_PASSWORD = "warning.wrong.password"; //ERROR public static final String ERROR_UNKNOWN_HOST = "error.unknown.host"; @@ -120,5 +162,11 @@ public class Strings public static final String ERROR_SERVER_CONNECTION_WITH_DETAILS = "error.server.connection.with.details"; public static final String ERROR_OPEN_FOLDER = "error.open.folder"; public static final String ERROR_OPEN_CHART = "error.open.chart"; + public static final String ERROR_OPEN_REPORT = "error.open.report"; public static final String ERROR_CHART_EXPORT = "error.chart.export"; + public static final String ERROR_REPORT_SAVE = "error.report.save"; + public static final String ERROR_SETTINGS_SAVE = "error.settings.save"; + public static final String ERROR_DATABASE_IMPORT = "error.database.import"; + public static final String ERROR_DATABASE_IMPORT_WRONG_FILE = "error.database.import.wrong.file"; + public static final String ERROR_PASSWORD_SAVE = "error.password.save"; } \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/main/_de.properties b/src/de/deadlocker8/budgetmaster/main/_de.properties index f332edaef..86a43386e 100644 --- a/src/de/deadlocker8/budgetmaster/main/_de.properties +++ b/src/de/deadlocker8/budgetmaster/main/_de.properties @@ -10,7 +10,9 @@ folder=Deadlocker/BudgetMaster # TITLE title.incomes=Einnahmen +title.income=Einnahme title.payments=Ausgaben +title.payment=Ausgabe title.categories=Kategorien title.categorie=Kategorie title.category.budgets=Verbrauch nach Kategorien @@ -22,10 +24,20 @@ title.category.new=Neue Kategorie title.category.edit=Kategorie bearbeiten title.chart.export=Diagramm exportieren title.modal=Vorgang l�uft +title.payment.edit={0} bearbeiten +title.payment.new=Neue {0} +title.filter=Filter +title.report.save=Bericht speichern +title.database.export=Datenbank exportieren +title.database.import=Datenbank importieren # LOAD load.charts=Lade Diagramme... load.data=Lade Daten... +load.report=Der Monatsbericht wird erstellt, bitte warten... +load.database.export=Die Datenbank wird exportiert, bitte warten... +load.database.import=Die Datenbank wird importiert, bitte warten... +load.database.delete=Die Datenbank wird gel�scht, bitte warten... # MISC category.none=Keine Kategorie @@ -39,6 +51,7 @@ ok=OK cancel=Abbrechen home.placeholder=Keine Daten verf�gbar home.budget=von {0} verbleibend +payments.placeholder=Keine Daten verf�gbar # REPORT report.position=Nr. @@ -57,6 +70,7 @@ report.footer.left=BudgetMaster Monatsbericht report.footer.center=Seite {0} report.repeating.yes=Ja report.repeating.no=Nein +report.initial.filename=BudgetMaster Monatsbericht - {0} {1}.pdf # MONTH month.january=Januar @@ -74,6 +88,8 @@ month.december=Dezember # NOTIFICATION notification.chart.export=Diagramm erfolgreich exportiert. +notification.report.save=Bericht erfolgreich gespeichert. +notification.settings.save=Erfolgreich gespeichert # INFO info.title.category.delete=Kategorie l�schen @@ -88,6 +104,25 @@ info.title.chart.export=Erfolgreich erstellt info.text.chart.export=Das Diagramm wurde erfolgreich exportiert. info.text.chart.export.open.folder=Ordner �ffnen info.text.chart.export.open.chart=Diagramm �ffnen +info.title.report.save=Erfolgreich erstellt +info.text.report.save=Der Monatsbericht wurde erfolgreich erstellt. +info.text.report.save.open.folder=Ordner �ffnen +info.text.report.save.open.report=Bericht �ffnen +info.title.database.export=Erfolgreich exportiert +info.text.database.export=Die Datenbank wurde erfolgreich exportiert. +info.title.database.import=Erfolgreich importiert +info.text.database.import=Die Datenbank wurde erfolgreich importiert. +info.title.database.import.dialog=Datebank importieren +info.text.database.import.dialog=Soll die Datenbank vor dem Importieren gel�scht werden? +info.text.database.import.dialog.delete=Ja, Datenbank l�schen +info.text.database.import.dialog.append=Nein, Daten hinzuf�gen +info.title.database.delete=Datenbank l�schen +info.header.text.database.delete=Soll die Datenbank wirklich gel�scht werden? +info.text.database.delete=Zur Best�tigung gib folgenden Code ein:\t{0} +info.title.welcome=Willkommen +info.header.text.welcome=Willkommen beim BudgetMaster +info.text.welcome.first.start=Dies scheint dein erster Besuch zu sein, da noch keine Einstellungen existieren.\nDamit es losgehen kann, �berlege dir ein Passwort und trage es in das Passwortfeld ein.\n\n(Hinweis: Das Passwort kann sp�ter jederzeit ge�ndert werden.)\n " +info.text.welcome.compatibility=Deine Einstellungsdatei ist veraltet und muss aktualisert werden.\nSeit Version v1.3.0 wird ein Passwort ben�tigt, um BudgetMaster zu entsperren. Damit es losgehen kann, �berlege dir ein Passwort und trage es in das Passwortfeld ein.\n\n(Hinweis: Das Passwort kann sp�ter jederzeit ge�ndert werden.)\n " # WARNING warning.enddate.before.startdate=Das Enddatum darf zeitlich nicht vor dem Startdatum liegen. @@ -104,6 +139,13 @@ warning.description.character.limit.reached.150=Die Notiz darf maximal 150 Zeich warning.payment.amount=Gib eine g�ltige Zahl f�r den Betrag ein. warning.empty.payment.date=Bitte w�hle ein Datum aus. warning.payment.repeating=Wenn Wiederholung aktiviert ist d�rfen nicht beide Eingabefelder 0 sein.\n(Zur Deaktivierung der Wiederholung einfach die Checkbox abw�hlen) +warning.empty.secret.client=Das Feld f�r das Client Passwort darf nicht leer sein. +warning.empty.url=Das Feld f�r die Server URL darf nicht leer sein. +warning.empty.secret.server=Das Server Passwortfeld darf nicht leer sein. +warning.empty.currency=Bitte gib deine gew�nschte W�hrung ein. +warning.wrong.verificationcode=Die Eingabe stimmt nicht mit dem Best�tigungscode �berein. +warning.empty.password=Bitte gib dein Passwort ein. +warning.wrong.password=Das Passwort ist nicht korrekt. # ERROR error.unknown.host=Es konnte keine Verbindung mit dem Internet hergestellt werden. @@ -118,4 +160,10 @@ error.server.connection=Beim Herstellen der Verbindung zum Server ist ein Fehler error.server.connection.with.details=Beim Herstellen der Verbindung zum Server ist ein Fehler aufgetreten. Bitte �berpr�fe deine Einstellungen.\n\nFehlerdetails:\n{0} error.open.folder=Der Ordner konnte nicht ge�ffnet werden.\n\n{0} error.open.chart=Das Diagramm konnte nicht ge�ffnet werden.\n\n{0} +error.open.report=Der Bericht konnte nicht ge�ffnet werden.\n\n{0} error.chart.export=Beim Exportieren des Diagramms ist ein Fehler aufgetreten:\n\n{0} +error.report.save=Beim Erstellen des Monatsberichts ist ein Fehler aufgetreten:\n\n{0} +error.settings.save=Beim Speichern der Einstellungen ist ein Fehler aufgetreten. +error.database.import=Beim Einlesen der Datei ist ein Fehler aufgetreten. +error.database.import.wrong.file=Die angegebene Datei enth�lt kein g�ltiges BudgetMaster-Datenformat und kann daher nicht importiert werden. +error.password.save=Beim Speichern des Passworts ist ein Fehler aufgetreten. diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/PaymentController.java b/src/de/deadlocker8/budgetmaster/ui/controller/PaymentController.java index 28a73ce19..279d1a6e5 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/PaymentController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/PaymentController.java @@ -13,6 +13,7 @@ import de.deadlocker8.budgetmaster.logic.serverconnection.ExceptionHandler; import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import de.deadlocker8.budgetmaster.ui.Refreshable; import de.deadlocker8.budgetmaster.ui.cells.PaymentCell; import fontAwesome.FontIconType; @@ -36,6 +37,7 @@ import javafx.stage.Stage; import javafx.util.Callback; import logger.Logger; import tools.ConvertTo; +import tools.Localization; public class PaymentController implements Refreshable { @@ -83,7 +85,7 @@ public class PaymentController implements Refreshable } }); - Label labelPlaceholder = new Label("Keine Daten verfügbar"); + Label labelPlaceholder = new Label(Localization.getString(Strings.PAYMENTS_PLACEHOLDER)); labelPlaceholder.setStyle("-fx-font-size: 16"); listView.setPlaceholder(labelPlaceholder); @@ -142,15 +144,15 @@ public class PaymentController implements Refreshable newStage.initModality(Modality.APPLICATION_MODAL); String titlePart; - titlePart = isPayment ? "Ausgabe" : "Einnahme"; + titlePart = isPayment ? Localization.getString(Strings.TITLE_PAYMENT) : Localization.getString(Strings.TITLE_INCOME); if(edit) { - newStage.setTitle(titlePart + " bearbeiten"); + newStage.setTitle(Localization.getString(Strings.TITLE_PAYMENT_EDIT, titlePart)); } else { - newStage.setTitle("Neue " + titlePart); + newStage.setTitle(Localization.getString(Strings.TITLE_PAYMENT_NEW, titlePart)); } newStage.setScene(new Scene(root)); @@ -247,7 +249,7 @@ public class PaymentController implements Refreshable Stage newStage = new Stage(); newStage.initOwner(controller.getStage()); newStage.initModality(Modality.APPLICATION_MODAL); - newStage.setTitle("Filter"); + newStage.setTitle(Localization.getString(Strings.TITLE_FILTER)); newStage.setScene(new Scene(root)); newStage.getIcons().add(controller.getIcon()); newStage.setResizable(false); diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java b/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java index b0453fa6a..d8a0da292 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java @@ -24,6 +24,7 @@ import de.deadlocker8.budgetmaster.logic.report.ReportGenerator; import de.deadlocker8.budgetmaster.logic.report.ReportItem; import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.Helpers; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import de.deadlocker8.budgetmaster.ui.Refreshable; import fontAwesome.FontIconType; import javafx.application.Platform; @@ -58,6 +59,7 @@ import javafx.util.Callback; import logger.Logger; import tools.AlertGenerator; import tools.ConvertTo; +import tools.Localization; import tools.Worker; public class ReportController implements Refreshable @@ -113,7 +115,7 @@ public class ReportController implements Refreshable checkBoxPositions.setSelected(true); hboxColumnPosition.getChildren().add(checkBoxPositions); - Label labelColumnPosition = new Label("Nr."); + Label labelColumnPosition = new Label(Localization.getString(Strings.REPORT_POSITION)); hboxColumnPosition.getChildren().add(labelColumnPosition); checkBoxPositions.selectedProperty().addListener((a, b, c)->{ @@ -160,7 +162,7 @@ public class ReportController implements Refreshable checkBoxDate.setSelected(true); hboxColumnDate.getChildren().add(checkBoxDate); - Label labelComlumnDate = new Label("Datum"); + Label labelComlumnDate = new Label(Localization.getString(Strings.REPORT_DATE)); hboxColumnDate.getChildren().add(labelComlumnDate); checkBoxDate.selectedProperty().addListener((a, b, c)->{ @@ -222,7 +224,7 @@ public class ReportController implements Refreshable checkBoxRepeating.setSelected(true); hboxColumnIsRepeating.getChildren().add(checkBoxRepeating); - Label labelColumnIsRepeating = new Label("Wiederholend"); + Label labelColumnIsRepeating = new Label(Localization.getString(Strings.REPORT_REPEATING)); hboxColumnIsRepeating.getChildren().add(labelColumnIsRepeating); checkBoxRepeating.selectedProperty().addListener((a, b, c)->{ @@ -257,7 +259,7 @@ public class ReportController implements Refreshable checkBoxCategory.setSelected(true); hboxColumnCategory.getChildren().add(checkBoxCategory); - Label labelColumnCategory = new Label("Kategorie"); + Label labelColumnCategory = new Label(Localization.getString(Strings.REPORT_CATEGORY)); hboxColumnCategory.getChildren().add(labelColumnCategory); checkBoxCategory.selectedProperty().addListener((a, b, c)->{ @@ -284,7 +286,7 @@ public class ReportController implements Refreshable checkBoxName.setSelected(true); hboxColumnName.getChildren().add(checkBoxName); - Label labelColumnName = new Label("Name"); + Label labelColumnName = new Label(Localization.getString(Strings.REPORT_NAME)); hboxColumnName.getChildren().add(labelColumnName); checkBoxName.selectedProperty().addListener((a, b, c)->{ @@ -311,7 +313,7 @@ public class ReportController implements Refreshable checkBoxDescription.setSelected(true); hboxColumnDescription.getChildren().add(checkBoxDescription); - Label labelColumnDescription = new Label("Notiz"); + Label labelColumnDescription = new Label(Localization.getString(Strings.REPORT_DESCRIPTION)); hboxColumnDescription.getChildren().add(labelColumnDescription); checkBoxDescription.selectedProperty().addListener((a, b, c)->{ @@ -372,7 +374,7 @@ public class ReportController implements Refreshable checkBoxRating.setSelected(true); hboxColumnRating.getChildren().add(checkBoxRating); - Label labelColumnRating = new Label("Bewertung"); + Label labelColumnRating = new Label(Localization.getString(Strings.REPORT_RATING)); hboxColumnRating.getChildren().add(labelColumnRating); checkBoxRating.selectedProperty().addListener((a, b, c)->{ @@ -410,7 +412,7 @@ public class ReportController implements Refreshable checkBoxAmount.setSelected(true); hboxColumnAmount.getChildren().add(checkBoxAmount); - Label labelColumnAmount = new Label("Betrag"); + Label labelColumnAmount = new Label(Localization.getString(Strings.REPORT_AMOUNT)); hboxColumnAmount.getChildren().add(labelColumnAmount); checkBoxAmount.selectedProperty().addListener((a, b, c)->{ @@ -430,7 +432,7 @@ public class ReportController implements Refreshable columnFilter.addColumn(type); } - Label labelPlaceholder = new Label("Keine Daten verfügbar"); + Label labelPlaceholder = new Label(Localization.getString(Strings.PAYMENTS_PLACEHOLDER)); labelPlaceholder.setStyle("-fx-font-size: 16"); tableView.setPlaceholder(labelPlaceholder); @@ -455,7 +457,7 @@ public class ReportController implements Refreshable Stage newStage = new Stage(); newStage.initOwner(controller.getStage()); newStage.initModality(Modality.APPLICATION_MODAL); - newStage.setTitle("Filter"); + newStage.setTitle(Localization.getString(Strings.TITLE_FILTER)); newStage.setScene(new Scene(root)); newStage.getIcons().add(controller.getIcon()); newStage.setResizable(false); @@ -517,7 +519,7 @@ public class ReportController implements Refreshable } FileChooser fileChooser = new FileChooser(); - fileChooser.setTitle("Bericht speichern"); + fileChooser.setTitle(Localization.getString(Strings.TITLE_REPORT_SAVE)); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("PDF (*.pdf)", "*.pdf"); if(reportPath != null) { @@ -529,7 +531,8 @@ public class ReportController implements Refreshable DateTime currentDate = controller.getCurrentDate(); String currentMonth = currentDate.toString("MMMM"); String currentYear = currentDate.toString("YYYY"); - fileChooser.setInitialFileName("BudgetMaster Monatsbericht - " + currentMonth + " " + currentYear + ".pdf"); + + fileChooser.setInitialFileName( Localization.getString(Strings.REPORT_INITIAL_FILENAME, currentMonth, currentYear)); } fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showSaveDialog(controller.getStage()); @@ -550,7 +553,7 @@ public class ReportController implements Refreshable controller.getCurrentDate(), budget); - Stage modalStage = Helpers.showModal("Vorgang läuft", "Der Monatsbericht wird erstellt, bitte warten...", controller.getStage(), controller.getIcon()); + Stage modalStage = Helpers.showModal(Localization.getString(Strings.TITLE_MODAL), Localization.getString(Strings.LOAD_REPORT), controller.getStage(), controller.getIcon()); Worker.runLater(() -> { try @@ -563,18 +566,18 @@ public class ReportController implements Refreshable modalStage.close(); } - controller.showNotification("Bericht erfolgreich gespeichert"); + controller.showNotification(Localization.getString(Strings.NOTIFICATION_REPORT_SAVE)); Alert alert = new Alert(AlertType.INFORMATION); - alert.setTitle("Erfolgreich erstellt"); + alert.setTitle(Localization.getString(Strings.INFO_TITLE_REPORT_SAVE)); alert.setHeaderText(""); - alert.setContentText("Der Monatsbericht wurde erfolgreich erstellt"); + alert.setContentText(Localization.getString(Strings.INFO_TEXT_REPORT_SAVE)); Stage dialogStage = (Stage)alert.getDialogPane().getScene().getWindow(); dialogStage.getIcons().add(controller.getIcon()); - ButtonType buttonTypeOne = new ButtonType("Ordner öffnen"); - ButtonType buttonTypeTwo = new ButtonType("Bericht öffnen"); - ButtonType buttonTypeThree = new ButtonType("OK"); + ButtonType buttonTypeOne = new ButtonType(Localization.getString(Strings.INFO_TEXT_REPORT_SAVE_OPEN_FOLDER)); + ButtonType buttonTypeTwo = new ButtonType(Localization.getString(Strings.INFO_TEXT_REPORT_SAVE_OPEN_REPORT)); + ButtonType buttonTypeThree = new ButtonType(Localization.getString(Strings.OK)); alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeTwo, buttonTypeThree); Optional<ButtonType> result = alert.showAndWait(); @@ -587,7 +590,14 @@ public class ReportController implements Refreshable catch(IOException e1) { Logger.error(e1); - AlertGenerator.showAlert(AlertType.ERROR, "Fehler", "", "Der Ordner konnte nicht geöffnet werden\n\n" + e1.getMessage(), controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.ERROR, + Localization.getString(Strings.TITLE_ERROR), + "", + Localization.getString(Strings.ERROR_OPEN_FOLDER, e1.getMessage()), + controller.getIcon(), + controller.getStage(), + null, + false); } } else if (result.get() == buttonTypeTwo) @@ -599,7 +609,14 @@ public class ReportController implements Refreshable catch(IOException e1) { Logger.error(e1); - AlertGenerator.showAlert(AlertType.ERROR, "Fehler", "", "Der Bericht konnte nicht geöffnet werden\n\n" + e1.getMessage(), controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.ERROR, + Localization.getString(Strings.TITLE_ERROR), + "", + Localization.getString(Strings.ERROR_OPEN_REPORT, e1.getMessage()), + controller.getIcon(), + controller.getStage(), + null, + false); } } else @@ -616,7 +633,14 @@ public class ReportController implements Refreshable { modalStage.close(); } - AlertGenerator.showAlert(AlertType.ERROR, "Fehler", "", "Beim Erstellen des Monatsberichts ist ein Fehler aufgetreten:\n\n" + e.getMessage(), controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.ERROR, + Localization.getString(Strings.TITLE_ERROR), + "", + Localization.getString(Strings.ERROR_REPORT_SAVE, e.getMessage()), + controller.getIcon(), + controller.getStage(), + null, + false); }); } }); diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/SettingsController.java b/src/de/deadlocker8/budgetmaster/ui/controller/SettingsController.java index 8e89adaaa..05c5f617e 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/SettingsController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/SettingsController.java @@ -11,6 +11,7 @@ import de.deadlocker8.budgetmaster.logic.serverconnection.ServerConnection; import de.deadlocker8.budgetmaster.logic.utils.Colors; import de.deadlocker8.budgetmaster.logic.utils.FileHelper; import de.deadlocker8.budgetmaster.logic.utils.Helpers; +import de.deadlocker8.budgetmaster.logic.utils.Strings; import de.deadlocker8.budgetmasterserver.logic.Database; import javafx.application.Platform; import javafx.fxml.FXML; @@ -33,6 +34,7 @@ import tools.AlertGenerator; import tools.BASE58Type; import tools.ConvertTo; import tools.HashUtils; +import tools.Localization; import tools.RandomCreations; import tools.Worker; @@ -89,6 +91,7 @@ public class SettingsController buttonExportDB.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); buttonImportDB.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); buttonDeleteDB.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_RED) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 14;"); + //TODO textFieldURL.setPromptText("z.B. https://yourdomain.de"); textFieldCurrency.setPromptText("z.B. €, CHF, $"); textAreaTrustedHosts.setPromptText("z.B. localhost"); @@ -125,25 +128,53 @@ public class SettingsController if(clientSecret == null || clientSecret.equals("")) { - AlertGenerator.showAlert(AlertType.WARNING, "Warnung", "", "Das Feld für das Client Passwort darf nicht leer sein!", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.WARNING, + Localization.getString(Strings.TITLE_WARNING), + "", + Localization.getString(Strings.WARNING_EMPTY_SECRET_CLIENT), + controller.getIcon(), + controller.getStage(), + null, + false); return; } if(url == null || url.equals("")) { - AlertGenerator.showAlert(AlertType.WARNING, "Warnung", "", "Das Feld für die Server URL darf nicht leer sein!", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.WARNING, + Localization.getString(Strings.TITLE_WARNING), + "", + Localization.getString(Strings.WARNING_EMPTY_URL), + controller.getIcon(), + controller.getStage(), + null, + false); return; } if(secret == null || secret.equals("")) { - AlertGenerator.showAlert(AlertType.WARNING, "Warnung", "", "Das Server Passwortfeld darf nicht leer sein!", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.WARNING, + Localization.getString(Strings.TITLE_WARNING), + "", + Localization.getString(Strings.WARNING_EMPTY_SECRET_SERVER), + controller.getIcon(), + controller.getStage(), + null, + false); return; } if(currency == null || currency.equals("")) { - AlertGenerator.showAlert(AlertType.WARNING, "Warnung", "", "Bitte gib deine gewünschte Währung ein!", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.WARNING, + Localization.getString(Strings.TITLE_WARNING), + "", + Localization.getString(Strings.WARNING_EMPTY_CURRENCY), + controller.getIcon(), + controller.getStage(), + null, + false); return; } @@ -211,26 +242,33 @@ public class SettingsController catch(IOException e) { Logger.error(e); - AlertGenerator.showAlert(AlertType.ERROR, "Fehler", "", "Beim Speichern der Einstellungen ist ein Fehler aufgetreten", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.ERROR, + Localization.getString(Strings.TITLE_ERROR), + "", + Localization.getString(Strings.ERROR_SETTINGS_SAVE), + controller.getIcon(), + controller.getStage(), + null, + false); } textFieldClientSecret.setText("******"); textFieldSecret.setText("******"); controller.refresh(controller.getFilterSettings()); - controller.showNotification("Erfolgreich gespeichert"); + controller.showNotification(Localization.getString(Strings.NOTIFICATION_SETTINGS_SAVE)); } public void exportDB() { FileChooser fileChooser = new FileChooser(); - fileChooser.setTitle("Datenbank exportieren"); + fileChooser.setTitle(Localization.getString(Strings.TITLE_DATABASE_EXPORT)); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("JSON (*.json)", "*.json"); fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showSaveDialog(controller.getStage()); if(file != null) { - Stage modalStage = Helpers.showModal("Vorgang läuft", "Die Datenbank wird exportiert, bitte warten...", controller.getStage(), controller.getIcon()); + Stage modalStage = Helpers.showModal(Localization.getString(Strings.TITLE_MODAL), Localization.getString(Strings.LOAD_DATABASE_EXPORT), controller.getStage(), controller.getIcon()); Worker.runLater(() -> { try @@ -244,7 +282,14 @@ public class SettingsController { modalStage.close(); } - AlertGenerator.showAlert(AlertType.INFORMATION, "Erfolgreich exportiert", "", "Die Datenbank wurde erfolgreich exportiert.", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.INFORMATION, + Localization.getString(Strings.INFO_TITLE_DATABASE_EXPORT), + "", + Localization.getString(Strings.INFO_TEXT_DATABASE_EXPORT), + controller.getIcon(), + controller.getStage(), + null, + false); }); } catch(Exception e) @@ -265,7 +310,7 @@ public class SettingsController private void importDatabase() { FileChooser fileChooser = new FileChooser(); - fileChooser.setTitle("Datenbank importieren"); + fileChooser.setTitle(Localization.getString(Strings.TITLE_DATABASE_IMPORT)); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("JSON (*.json)", "*.json"); fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showOpenDialog(controller.getStage()); @@ -277,18 +322,32 @@ public class SettingsController database = FileHelper.loadDatabaseJSON(file); if(database.getCategories() == null || database.getNormalPayments() == null || database.getRepeatingPayments() == null) { - AlertGenerator.showAlert(AlertType.ERROR, "Fehler", "", "Die angegebene Datei enthält kein gültiges BudgetMaster-Datenformat und kann daher nicht importiert werden.", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.ERROR, + Localization.getString(Strings.TITLE_ERROR), + "", + Localization.getString(Strings.ERROR_DATABASE_IMPORT_WRONG_FILE), + controller.getIcon(), + controller.getStage(), + null, + false); return; } } catch(IOException e1) { Logger.error(e1); - AlertGenerator.showAlert(AlertType.ERROR, "Fehler", "", "Beim Einlesen der Datei ist ein Fehler aufgetreten.", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.ERROR, + Localization.getString(Strings.TITLE_ERROR), + "", + Localization.getString(Strings.ERROR_DATABASE_IMPORT), + controller.getIcon(), + controller.getStage(), + null, + false); return; } - Stage modalStage = Helpers.showModal("Vorgang läuft", "Die Datenbank wird importiert, bitte warten...", controller.getStage(), controller.getIcon()); + Stage modalStage = Helpers.showModal(Localization.getString(Strings.TITLE_MODAL), Localization.getString(Strings.LOAD_DATABASE_IMPORT), controller.getStage(), controller.getIcon()); Worker.runLater(() -> { try @@ -301,7 +360,14 @@ public class SettingsController { modalStage.close(); } - AlertGenerator.showAlert(AlertType.INFORMATION, "Erfolgreich exportiert", "", "Die Datenbank wurder erfolgreich importiert.", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.INFORMATION, + Localization.getString(Strings.INFO_TITLE_DATABASE_IMPORT), + "", + Localization.getString(Strings.INFO_TEXT_DATABASE_IMPORT), + controller.getIcon(), + controller.getStage(), + null, + false); }); } catch(Exception e) @@ -322,16 +388,16 @@ public class SettingsController public void importDB() { Alert alert = new Alert(AlertType.CONFIRMATION); - alert.setTitle("Datenbank importieren"); + alert.setTitle(Localization.getString(Strings.INFO_TITLE_DATABASE_IMPORT_DIALOG)); alert.setHeaderText(""); - alert.setContentText("Soll die Datenbank vor dem Importieren gelöscht werden?"); + alert.setContentText(Localization.getString(Strings.INFO_TEXT_DATABASE_IMPORT_DIALOG)); Stage dialogStage = (Stage)alert.getDialogPane().getScene().getWindow(); dialogStage.getIcons().add(controller.getIcon()); dialogStage.initOwner(controller.getStage()); - ButtonType buttonTypeDelete = new ButtonType("Ja, Datenbank löschen"); - ButtonType buttonTypeAppend = new ButtonType("Nein, Daten hinzufügen"); - ButtonType buttonTypeCancel = new ButtonType("Abbrechen", ButtonData.CANCEL_CLOSE); + ButtonType buttonTypeDelete = new ButtonType(Localization.getString(Strings.INFO_TEXT_DATABASE_IMPORT_DIALOG_DELETE)); + ButtonType buttonTypeAppend = new ButtonType(Localization.getString(Strings.INFO_TEXT_DATABASE_IMPORT_DIALOG_APPEND)); + ButtonType buttonTypeCancel = new ButtonType(Localization.getString(Strings.CANCEL), ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonTypeDelete, buttonTypeAppend, buttonTypeCancel); Optional<ButtonType> result = alert.showAndWait(); @@ -355,9 +421,9 @@ public class SettingsController String verificationCode = ConvertTo.toBase58(RandomCreations.generateRandomMixedCaseString(4, true), true, BASE58Type.UPPER); TextInputDialog dialog = new TextInputDialog(); - dialog.setTitle("Datenbank löschen"); - dialog.setHeaderText("Soll die Datenbank wirklich gelöscht werden?"); - dialog.setContentText("Zur Bestätigung gib folgenden Code ein:\t" + verificationCode); + dialog.setTitle(Localization.getString(Strings.INFO_TITLE_DATABASE_DELETE)); + dialog.setHeaderText(Localization.getString(Strings.INFO_HEADER_TEXT_DATABASE_DELETE)); + dialog.setContentText(Localization.getString(Strings.INFO_TEXT_DATABASE_DELETE, verificationCode)); Stage dialogStage = (Stage)dialog.getDialogPane().getScene().getWindow(); dialogStage.getIcons().add(controller.getIcon()); dialogStage.initOwner(controller.getStage()); @@ -367,7 +433,7 @@ public class SettingsController { if(result.get().equals(verificationCode)) { - Stage modalStage = Helpers.showModal("Vorgang läuft", "Die Datenbank wird gelöscht, bitte warten...", controller.getStage(), controller.getIcon()); + Stage modalStage = Helpers.showModal(Localization.getString(Strings.TITLE_MODAL), Localization.getString(Strings.LOAD_DATABASE_DELETE), controller.getStage(), controller.getIcon()); Worker.runLater(() -> { try @@ -400,7 +466,14 @@ public class SettingsController } else { - AlertGenerator.showAlert(AlertType.WARNING, "Warnung", "", "Die Eingabe stimmt nicht mit dem Bestätigungscode überein.", controller.getIcon(), controller.getStage(), null, false); + AlertGenerator.showAlert(AlertType.WARNING, + Localization.getString(Strings.TITLE_WARNING), + "", + Localization.getString(Strings.WARNING_WRONG_VERIFICATION_CODE), + controller.getIcon(), + controller.getStage(), + null, + false); deleteDB(); } } diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/SplashScreenController.java b/src/de/deadlocker8/budgetmaster/ui/controller/SplashScreenController.java index 0d766cb34..5da3fecb5 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/SplashScreenController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/SplashScreenController.java @@ -67,7 +67,14 @@ public class SplashScreenController settings = new Settings(); //first start of budgetmaster Platform.runLater(() -> { - AlertGenerator.showAlert(AlertType.INFORMATION, "Willkommen", "Willkommen beim BudgetMaster", "Dies scheint dein erster Besuch zu sein, da noch keine Einstellungen existieren.\nDamit es losgehen kann, überlege dir ein Passwort und trage es in das Passwortfeld ein.\n\n(Hinweis: Das Passwort kann später jederzeit geändert werden.)\n ", icon, stage, null, false); + AlertGenerator.showAlert(AlertType.INFORMATION, + Localization.getString(Strings.INFO_TITLE_WELCOME), + Localization.getString(Strings.INFO_HEADER_TEXT_WELCOME), + Localization.getString(Strings.INFO_TEXT_WELCOME_FIRST_START), + icon, + stage, + null, + false); }); isFirstStart = true; } @@ -77,7 +84,14 @@ public class SplashScreenController { //compatibility (settings exists but from older version without clientSecret) Platform.runLater(() -> { - AlertGenerator.showAlert(AlertType.INFORMATION, "Willkommen", "Willkommen beim BudgetMaster", "Deine Einstellungsdatei ist veraltet und muss aktualisert werden.\nSeit Version v1.3.0 wird ein Passwort benötigt, um BudgetMaster zu entsperren. Damit es losgehen kann, überlege dir ein Passwort und trage es in das Passwortfeld ein.\n\n(Hinweis: Das Passwort kann später jederzeit geändert werden.)\n ", icon, stage, null, false); + AlertGenerator.showAlert(AlertType.INFORMATION, + Localization.getString(Strings.INFO_TITLE_WELCOME), + Localization.getString(Strings.INFO_HEADER_TEXT_WELCOME), + Localization.getString(Strings.INFO_TEXT_WELCOME_COMPATIBILITY), + icon, + stage, + null, + false); }); isFirstStart = true; } @@ -93,7 +107,14 @@ public class SplashScreenController String password = textFieldPassword.getText().trim(); if(password == null || password.isEmpty()) { - AlertGenerator.showAlert(AlertType.WARNING, "Warnung", "", "Bitte gib dein Passwort ein.", icon, stage, null, false); + AlertGenerator.showAlert(AlertType.WARNING, + Localization.getString(Strings.TITLE_WARNING), + "", + Localization.getString(Strings.WARNING_EMPTY_PASSWORD), + icon, + stage, + null, + false); return; } @@ -111,7 +132,14 @@ public class SplashScreenController catch(IOException e) { Logger.error(e); - AlertGenerator.showAlert(AlertType.ERROR, "Fehler", "", "Beim Speichern des Passworts ist ein Fehler aufgetreten.", icon, stage, null, false); + AlertGenerator.showAlert(AlertType.ERROR, + Localization.getString(Strings.TITLE_ERROR), + "", + Localization.getString(Strings.ERROR_PASSWORD_SAVE), + icon, + stage, + null, + false); } } else @@ -119,7 +147,14 @@ public class SplashScreenController //check password if(!HashUtils.hash(password, Helpers.SALT).equals(settings.getClientSecret())) { - AlertGenerator.showAlert(AlertType.WARNING, "Warnung", "", "Das Passwort ist nicht korrekt.", icon, stage, null, false); + AlertGenerator.showAlert(AlertType.WARNING, + Localization.getString(Strings.TITLE_WARNING), + "", + Localization.getString(Strings.WARNING_WRONG_PASSWORD), + icon, + stage, + null, + false); return; } -- GitLab