From e753e1e987beb312047063c0f6ba4da8d4d20773 Mon Sep 17 00:00:00 2001 From: Dale Schultz Date: Tue, 31 Dec 2019 17:11:57 -0500 Subject: [PATCH] Internationalize AbstractAction Class and all classes that extend it. --- .../menubar/action/AbstractAction.properties | 77 +++++++++++++++++++ .../action/GenericPluginMenuAction.java | 8 +- .../action/GlobalAdjustmentAction.java | 24 +++--- .../action/LearningTableValuesAction.java | 17 ++-- .../menubar/action/LoadProfileAction.java | 7 +- .../menubar/action/LogFileLocationAction.java | 6 +- .../action/LogFileNumberFormatAction.java | 10 +-- .../LoggerDefinitionLocationAction.java | 8 +- .../menubar/action/ReadEcuCodesAction.java | 50 ++++++------ .../swing/menubar/action/ResetEcuAction.java | 30 ++++++-- .../menubar/action/SaveProfileAction.java | 9 ++- .../menubar/action/SaveProfileAsAction.java | 15 +++- .../menubar/action/SelectProtocolAction.java | 17 ++-- .../mts/plugin/Lm2MtsPluginMenuAction.java | 14 ++-- .../plugin/IntfKitPluginMenuAction.java | 11 +-- .../swing/menubar/action/AboutAction.java | 11 +-- .../swing/menubar/action/AbstractAction.java | 7 +- 17 files changed, 210 insertions(+), 111 deletions(-) create mode 100644 i18n/com/romraider/swing/menubar/action/AbstractAction.properties diff --git a/i18n/com/romraider/swing/menubar/action/AbstractAction.properties b/i18n/com/romraider/swing/menubar/action/AbstractAction.properties new file mode 100644 index 00000000..12e98b93 --- /dev/null +++ b/i18n/com/romraider/swing/menubar/action/AbstractAction.properties @@ -0,0 +1,77 @@ +# AboutAction +ABOUT = About {0} +VERSIONSTR = {0} - ECU Logger\nVersion: {1}\nBuild #: {2}\n{3}\nLogger Def Version: {4} + +# GenericPluginMenuAction +PLUGINSETTINGS = {0} Plugin Settings +SELECTPORT = Select COM port: + +# GlobalAdjustmentAction +GAATITLE = Adjust ECU Global Parameters +GAACONFIRM = Do you want to adjust the ECU's Global Timing or Idle RPM values? +GAASUCCESSMSG = ECU global adjustment successful! +GAAERRORMSG = Error performing ECU Global Timing or Idle RPM adjustment.\nCheck the following:\n* Logger has successfully connected to the ECU\n* Correct COM port is selected (if not Openport 2)\n* CAN bus logging mode is disabled\n* Cable is connected properly\n* Ignition is ON\n* Logger definition XML file is up to date\n +GAACANCELMSG = User cancelled ECU global adjustments. + +# LearningTableValuesAction +LTVTITLE = Learning Table Values +LTVINITMSG = To read Learning Table Values the Logger must first initialize with the\n{0}. Press the Restart button to connect with the Logger then try\nreading the Learning Table Values again.\n +LTVINTTITLE = Not Initialized +LTVINTERRUPT = Interrupt Logging to read the Learning Table values? + +# LoadProfileAction +LPASUCCESS = Profile successfully loaded: {0} + +# LogFileLocationAction +LFLAUPDATE = Log file output location successfully updated: {0} + +# LogFileNumberFormatAction +LFNFATITLE = Log File Number Format Change +LFNFAMSG = The Logger has been set to use the {0} number format.\n\nExit and restart the Logger to apply the new setting. + +# LoggerDefinitionLocationAction +LDLASUCCESS = Logger definition location successfully updated: {0} + +# ReadEcuCodesAction +RECADEFERROR = To read diagnostic codes the Logger requires a logger definition\nXML file containing compatible DTC parameter definitions.\nUse the Help menu 'Update Logger Definition' item to\ngo online and download the latest logger definition.\n +RECADEFERRORTITLE = Definition Error +RECANOINIT = To read diagnostic codes the Logger must first initialize with the\n{0}. Press the Restart button to connect with the Logger then\ntry reading the codes again.\n +RECANOINITTITLE = Not Initialized +RECACONFIRM = Do you want to read the {0} diagnostic codes? +RECACONFIRMTITLE = Read {0} diagnostic codes +RECANOCODES = No diagnostic codes set +RECANOCODESTILTE = Read Success +RECAREADERROR = Error reading {0} diagnostic codes.\nCheck the following:\n* Logger has successfully connected to the ECU\n* Correct COM port is selected (if not Openport 2)\n* Cable is connected properly\n* Ignition is ON\n* Logger definition XML file is up to date +RECAREADERRORTITLE = Error Read {0} +RECAREPORTERROR = Error performing {0} codes read + +# ResetEcuAction +REATITLE = Reset {0} +REACONFIM = Do you want to reset the {0}? +REASUCCESS = Reset Successful!\nTurn your ignition OFF and then\nback ON to complete the process. +REAERROR = Error performing {0} reset.\nCheck the following:\n* Correct COM port selected\n* Cable is connected properly\n* Ignition is ON\n* Logger is stopped +REAREPORTERROR = Error performing {0} reset + +# SaveProfileAsAction & SaveProfileAction +SPATITLE = Profile: {0} +SPAMSG = Profile successfully saved: {0} +SPAACONFIRM = {0} already exists! Overwrite? + +# SelectProtocolAction +SPRABTN = Select +SPRATITLE = Communications Settings +SPRACANCEL = Cancel +SPRATRANSPORT = Select the transport to use under the desired protocol to query the target control module +SPRATREE = Protocol and Transport Selection +SPRACONFIRM = Are you sure you want to change the logging protocol? +SPRACONFIRMTITLE = Confirm new selection + +# Lm2MtsPluginMenuAction +LPMAPORT = Select MTS port: +LPMAPORTTITLE = {0} Plugin Settings +LPMANOPORTS = -1 - [ no ports found ] +LPMAPORTS = {0,number,integer} - [ {1}: {2,number,integer} sensors ] + +# IntfKitPluginMenuAction +IPMAMSG = Un-select each updated External Phidget data item on each Data,\nGraph and Dashboard Logger tabs to complete the update.\n\nLogging profiles using the old Phidget settings must be loaded\nand re-saved with the new settings. +IPMAMSGTITLE = Phidget InterfaceKit Settings Applied diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GenericPluginMenuAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GenericPluginMenuAction.java index 5e452cf4..28f89bb6 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GenericPluginMenuAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GenericPluginMenuAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ import gnu.io.CommPortIdentifier; import static javax.swing.JOptionPane.QUESTION_MESSAGE; import static javax.swing.JOptionPane.showInputDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; import java.util.List; public final class GenericPluginMenuAction extends AbstractAction { @@ -42,8 +43,9 @@ public final class GenericPluginMenuAction extends AbstractAction { public void actionPerformed(ActionEvent actionEvent) { String port = (String) showInputDialog( logger, - "Select COM port:", - dataSource.getName() + " Plugin Settings", + rb.getString("SELECTPORT"), + MessageFormat.format( + rb.getString("PLUGINSETTINGS"), dataSource.getName()), QUESTION_MESSAGE, null, getPorts(), diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GlobalAdjustmentAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GlobalAdjustmentAction.java index 1dca221d..c3e541ab 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GlobalAdjustmentAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/GlobalAdjustmentAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2015 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,8 +66,8 @@ public final class GlobalAdjustmentAction extends AbstractAction { private final int showConfirmation() { return showConfirmDialog(logger, - "Do you want to adjust the ECU's Global Timing or Idle RPM values?", - "Adjust ECU Global Parameters", + rb.getString("GAACONFIRM"), + rb.getString("GAATITLE"), YES_NO_OPTION, QUESTION_MESSAGE); } @@ -76,26 +76,20 @@ public final class GlobalAdjustmentAction extends AbstractAction { final int result = doAdjustEcu(); if (result == 1) { showMessageDialog(logger, - "ECU global adjustment successful !", - "Adjust ECU Global Parameters", + rb.getString("GAASUCCESSMSG"), + rb.getString("GAATITLE"), INFORMATION_MESSAGE); } else if (result == 0) { showMessageDialog(logger, - "Error performing ECU Global Timing or Idle RPM adjustment.\n" + - "Check the following:\n" + - "* Logger has successfully conencted to the ECU\n" + - "* Correct COM port is selected (if not Openport 2)\n" + - "* CAN bus logging mode is disabled\n" + - "* Cable is connected properly\n* Ignition is ON\n" + - "* Logger definition XML file is up to date\n", - "Adjust ECU Global Parameters", + rb.getString("GAAERRORMSG"), + rb.getString("GAATITLE"), ERROR_MESSAGE); } if (result == -1) { showMessageDialog(logger, - "User cancelled ECU global adjustments.", - "Adjust ECU Global Parameters", + rb.getString("GAACANCELMSG"), + rb.getString("GAATITLE"), INFORMATION_MESSAGE); } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LearningTableValuesAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LearningTableValuesAction.java index 194f2dd0..4fe981e1 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LearningTableValuesAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LearningTableValuesAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ import static javax.swing.JOptionPane.showConfirmDialog; import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; import com.romraider.logger.ecu.EcuLogger; import com.romraider.swing.menubar.action.AbstractAction; @@ -38,14 +39,10 @@ public final class LearningTableValuesAction extends AbstractAction { public final void actionPerformed(ActionEvent actionEvent) { if (!logger.isEcuInit()) { - final String notInit = "To read Learning Table Values the " + - "Logger must first intialize with the\n" + - logger.getTarget() + - ". Press the Restart button to connect with the Logger then try\n" + - "reading the Learning Table Values again.\n"; showMessageDialog(logger, - notInit, - "Not Initialized", ERROR_MESSAGE); + MessageFormat.format( + rb.getString("LTVINITMSG"), logger.getTarget()), + rb.getString("LTVINTTITLE"), ERROR_MESSAGE); } else { if (!logger.isLogging() || @@ -59,8 +56,8 @@ public final class LearningTableValuesAction extends AbstractAction { private final int showConfirmation() { return showConfirmDialog(logger, - "Interrupt Logging to read the Learning Table values?", - "Learning Table Values", + rb.getString("LTVINTERRUPT"), + rb.getString("LTVTITLE"), YES_NO_OPTION, QUESTION_MESSAGE); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoadProfileAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoadProfileAction.java index b2fa4c32..ebb53fab 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoadProfileAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoadProfileAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ import static com.romraider.logger.ecu.ui.swing.menubar.util.FileHelper.getProfi import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import javax.swing.JFileChooser; @@ -54,9 +55,9 @@ public final class LoadProfileAction extends AbstractAction { if (logger.loadUserProfile(profileFilePath)) { logger.getSettings().setLoggerProfileFilePath(profileFilePath); logger.restartLogging(); - logger.reportMessage("Profile succesfully loaded: " + profileFilePath); + logger.reportMessage(MessageFormat.format( + rb.getString("LPASUCCESS"), profileFilePath)); } } } - } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileLocationAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileLocationAction.java index fa50d262..fa950124 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileLocationAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileLocationAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ import static javax.swing.JFileChooser.APPROVE_OPTION; import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import javax.swing.JFileChooser; @@ -53,7 +54,8 @@ public final class LogFileLocationAction extends AbstractAction { if (fc.showOpenDialog(logger) == APPROVE_OPTION) { String loggerOutputDirPath = fc.getSelectedFile().getAbsolutePath(); logger.getSettings().setLoggerOutputDirPath(loggerOutputDirPath); - logger.reportMessage("Log file output location successfully updated: " + loggerOutputDirPath); + logger.reportMessage(MessageFormat.format( + rb.getString("LFLAUPDATE"), loggerOutputDirPath)); } } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileNumberFormatAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileNumberFormatAction.java index 0c584257..8694f160 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileNumberFormatAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LogFileNumberFormatAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ import static javax.swing.JOptionPane.INFORMATION_MESSAGE; import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; import com.romraider.logger.ecu.EcuLogger; import com.romraider.swing.menubar.action.AbstractAction; @@ -43,10 +44,9 @@ public final class LogFileNumberFormatAction extends AbstractAction { else { logger.getSettings().setLocale(SYSTEM_NUMFORMAT); } - showMessageDialog(logger, "The Logger has been set to use the " + - logger.getSettings().getLocale() + " number format.\n\n" + - "Exit and restart the Logger to apply the new setting.", - "Log File Number Format Change", INFORMATION_MESSAGE); + showMessageDialog(logger, MessageFormat.format( + rb.getString("LFNFAMSG"), logger.getSettings().getLocale()), + rb.getString("LFNFATITLE"), INFORMATION_MESSAGE); } catch (Exception e) { logger.reportError(e); } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoggerDefinitionLocationAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoggerDefinitionLocationAction.java index fa2b5f70..35e6855f 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoggerDefinitionLocationAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/LoggerDefinitionLocationAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ import static javax.swing.JFileChooser.APPROVE_OPTION; import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import javax.swing.JFileChooser; @@ -55,7 +56,8 @@ public final class LoggerDefinitionLocationAction extends AbstractAction { if (fc.showOpenDialog(logger) == APPROVE_OPTION) { String path = fc.getSelectedFile().getAbsolutePath(); logger.getSettings().setLoggerDefinitionFilePath(path); - logger.reportMessage("Logger definition location successfully updated: " + path); + logger.reportMessage(MessageFormat.format( + rb.getString("LDLASUCCESS"), path)); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ReadEcuCodesAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ReadEcuCodesAction.java index cfb5a2be..98b58bf5 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ReadEcuCodesAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ReadEcuCodesAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2014 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ import static javax.swing.JOptionPane.showConfirmDialog; import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; import com.romraider.logger.ecu.EcuLogger; import com.romraider.swing.menubar.action.AbstractAction; @@ -39,24 +40,14 @@ public final class ReadEcuCodesAction extends AbstractAction { public final void actionPerformed(ActionEvent actionEvent) { if (logger.getDtcodesEmpty()) { - final String wrongDefVersion = "To read diagnostic codes the " + - "Logger requires a logger definfition\n" + - "XML file containing compatible DTC parameter definitions.\n" + - "Use the Help menu 'Update Logger Definition' item to\n" + - "go online and download the latest logger definition.\n"; showMessageDialog(logger, - wrongDefVersion, - "Definition Error", ERROR_MESSAGE); + rb.getString("RECADEFERROR"), + rb.getString("RECADEFERRORTITLE"), ERROR_MESSAGE); } else if (!logger.isEcuInit()) { - final String notInit = "To read diagnostic codes the " + - "Logger must first intialize with the\n" + - logger.getTarget() + - ". Press the Restart button to connect with the Logger then\n" + - "try reading the codes again.\n"; - showMessageDialog(logger, - notInit, - "Not Initialized", ERROR_MESSAGE); + showMessageDialog(logger,MessageFormat.format( + rb.getString("RECANOINIT"), logger.getTarget()), + rb.getString("RECANOINITTITLE"), ERROR_MESSAGE); } else { final boolean logging = logger.isLogging(); @@ -71,9 +62,10 @@ public final class ReadEcuCodesAction extends AbstractAction { private final int showConfirmation() { return showConfirmDialog( logger, - "Do you want to read the " + logger.getTarget() + - " diagnostic codes?", - "Read " + logger.getTarget() + " diagnostic codes", + MessageFormat.format( + rb.getString("RECACONFIRM"), logger.getTarget()), + MessageFormat.format( + rb.getString("RECACONFIRMTITLE"), logger.getTarget()), YES_NO_OPTION, WARNING_MESSAGE); } @@ -82,19 +74,18 @@ public final class ReadEcuCodesAction extends AbstractAction { if (result == -1) { showMessageDialog( logger, - "No diagnostic codes set.", "Read Success", + rb.getString("RECANOCODES"), + rb.getString("RECANOCODESTILTE"), INFORMATION_MESSAGE); } else if (result == 0) { showMessageDialog( logger, - "Error reading " + logger.getTarget() + " diagnostic codes.\n" + - "Check the following:\n" + - "* Logger has successfully conencted to the ECU\n" + - "* Correct COM port is selected (if not Openport 2)\n" + - "* Cable is connected properly\n* Ignition is ON\n* " + - "* Logger definition XML file is up to date", - "Error Read " + logger.getTarget(), ERROR_MESSAGE); + MessageFormat.format( + rb.getString("RECAREADERROR"), logger.getTarget()), + MessageFormat.format( + rb.getString("RECAREADERRORTITLE"), logger.getTarget()), + ERROR_MESSAGE); } } @@ -103,7 +94,10 @@ public final class ReadEcuCodesAction extends AbstractAction { return logger.readEcuCodes(); } catch (Exception e) { logger.reportError( - "Error performing " + logger.getTarget() + " codes read", e); + MessageFormat.format( + rb.getString("RECAREPORTERROR"), + logger.getTarget()), + e); return 0; } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ResetEcuAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ResetEcuAction.java index f2de477f..3089668e 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ResetEcuAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/ResetEcuAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2015 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ import static javax.swing.JOptionPane.YES_NO_OPTION; import static javax.swing.JOptionPane.showConfirmDialog; import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; public final class ResetEcuAction extends AbstractAction { public ResetEcuAction(EcuLogger logger) { @@ -51,16 +52,29 @@ public final class ResetEcuAction extends AbstractAction { } private int showConfirmation() { - return showConfirmDialog(logger, "Do you want to reset the " + logger.getTarget() + "?", "Reset " + logger.getTarget(), YES_NO_OPTION, WARNING_MESSAGE); + return showConfirmDialog(logger, + MessageFormat.format( + rb.getString("REACONFIM"), logger.getTarget()), + MessageFormat.format( + rb.getString("REATITLE"), logger.getTarget()), + YES_NO_OPTION, + WARNING_MESSAGE); } private void resetEcu(int resetCode) { if (doReset(resetCode)) { - showMessageDialog(logger, "Reset Successful!\nTurn your ignition OFF and then\nback ON to complete the process.", - "Reset " + logger.getTarget(), INFORMATION_MESSAGE); + showMessageDialog(logger, + rb.getString("REASUCCESS"), + MessageFormat.format( + rb.getString("REATITLE"), logger.getTarget()), + INFORMATION_MESSAGE); } else { - showMessageDialog(logger, "Error performing " + logger.getTarget() + " reset.\nCheck the following:\n* Correct COM port selected\n" + - "* Cable is connected properly\n* Ignition is ON\n* Logger is stopped", "Reset " + logger.getTarget(), ERROR_MESSAGE); + showMessageDialog(logger, + MessageFormat.format( + rb.getString("REAERROR"), logger.getTarget()), + MessageFormat.format( + rb.getString("REATITLE"), logger.getTarget()), + ERROR_MESSAGE); } } @@ -68,7 +82,9 @@ public final class ResetEcuAction extends AbstractAction { try { return logger.resetEcu(resetCode); } catch (Exception e) { - logger.reportError("Error performing " + logger.getTarget() + " reset", e); + logger.reportError(MessageFormat.format( + rb.getString("REAREPORTERROR"), logger.getTarget()), + e); return false; } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAction.java index b8bc8787..56c06b9a 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ import static com.romraider.logger.ecu.ui.swing.menubar.util.FileHelper.saveProf import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import com.romraider.logger.ecu.EcuLogger; import com.romraider.swing.menubar.action.AbstractAction; @@ -48,7 +49,9 @@ public final class SaveProfileAction extends AbstractAction { File lastProfileFile = new File(SettingsManager.getSettings().getLoggerProfileFilePath()); String profileFilePath = saveProfileToFile(logger.getCurrentProfile(), lastProfileFile); logger.getSettings().setLoggerProfileFilePath(profileFilePath); - logger.reportMessageInTitleBar("Profile: " + profileFilePath); - logger.reportMessage("Profile succesfully saved: " + profileFilePath); + logger.reportMessageInTitleBar(MessageFormat.format( + rb.getString("SPATITLE"), profileFilePath)); + logger.reportMessage(MessageFormat.format( + rb.getString("SPAMSG"), profileFilePath)); } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAsAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAsAction.java index 9ab9a01f..12e9acef 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAsAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SaveProfileAsAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ import static javax.swing.JOptionPane.showConfirmDialog; import java.awt.event.ActionEvent; import java.io.File; +import java.text.MessageFormat; import javax.swing.JFileChooser; @@ -56,11 +57,17 @@ public final class SaveProfileAsAction extends AbstractAction { JFileChooser fc = getProfileFileChooser(lastProfileFile); if (fc.showSaveDialog(logger) == APPROVE_OPTION) { File selectedFile = fc.getSelectedFile(); - if (!selectedFile.exists() || showConfirmDialog(logger, selectedFile.getName() + " already exists! Overwrite?") == OK_OPTION) { + if (!selectedFile.exists() || + showConfirmDialog(logger, + MessageFormat.format( + rb.getString("SPAACONFIRM"), + selectedFile.getName())) == OK_OPTION) { String profileFilePath = saveProfileToFile(logger.getCurrentProfile(), selectedFile); logger.getSettings().setLoggerProfileFilePath(profileFilePath); - logger.reportMessageInTitleBar("Profile: " + profileFilePath); - logger.reportMessage("Profile succesfully saved as: " + profileFilePath); + logger.reportMessageInTitleBar(MessageFormat.format( + rb.getString("SPATITLE"), profileFilePath)); + logger.reportMessage(MessageFormat.format( + rb.getString("SPAMSG"), profileFilePath)); } } } diff --git a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SelectProtocolAction.java b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SelectProtocolAction.java index 20093869..6c8428ba 100644 --- a/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SelectProtocolAction.java +++ b/src/main/java/com/romraider/logger/ecu/ui/swing/menubar/action/SelectProtocolAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2015 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -71,13 +71,13 @@ public final class SelectProtocolAction extends AbstractAction { private class CommSettings extends JDialog { private static final long serialVersionUID = -6226102628115868401L; - private final JButton selectButton = new JButton("Select"); + private final JButton selectButton = new JButton(rb.getString("SPRABTN")); private final Map>> protocolList; private TreePath selectedPath; private CommSettings() { this.protocolList = logger.getProtocolList(); - setTitle("Communications Settings"); + setTitle(rb.getString("SPRATITLE")); setModalityType(ModalityType.APPLICATION_MODAL); setIconImage(logger.getIconImage()); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); @@ -108,7 +108,7 @@ public final class SelectProtocolAction extends AbstractAction { buttonPane.add(selectButton); getRootPane().setDefaultButton(selectButton); - final JButton cancelButton = new JButton("Cancel"); + final JButton cancelButton = new JButton(rb.getString("SPRACANCEL")); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -147,8 +147,7 @@ public final class SelectProtocolAction extends AbstractAction { } } else { - return "Select the transport to use under the desired " + - "protocol to query the target control module"; + return rb.getString("SPRATRANSPORT"); } } return null; @@ -212,7 +211,7 @@ public final class SelectProtocolAction extends AbstractAction { private MutableTreeNode buildNodeTree() { final DefaultMutableTreeNode root; - root = new DefaultMutableTreeNode("Protocol and Transport Selection"); + root = new DefaultMutableTreeNode(rb.getString("SPRATREE")); for (String protocol : protocolList.keySet()) { final DefaultMutableTreeNode protocolNode = new DefaultMutableTreeNode(protocol); @@ -235,8 +234,8 @@ public final class SelectProtocolAction extends AbstractAction { private final void confirmSelection() { final int result = showConfirmDialog(logger, - "Are you sure you want to change the logging protocol?", - "Confirm new selection", + rb.getString("SPRACONFIRM"), + rb.getString("SPRACONFIRMTITLE"), YES_NO_OPTION, QUESTION_MESSAGE); diff --git a/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsPluginMenuAction.java b/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsPluginMenuAction.java index 2797c47d..50435364 100644 --- a/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsPluginMenuAction.java +++ b/src/main/java/com/romraider/logger/external/innovate/lm2/mts/plugin/Lm2MtsPluginMenuAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ import com.romraider.swing.menubar.action.AbstractAction; import static javax.swing.JOptionPane.QUESTION_MESSAGE; import static javax.swing.JOptionPane.showInputDialog; import java.awt.event.ActionEvent; +import java.text.MessageFormat; public final class Lm2MtsPluginMenuAction extends AbstractAction { private final ExternalDataSource dataSource; @@ -39,8 +40,9 @@ public final class Lm2MtsPluginMenuAction extends AbstractAction { public void actionPerformed(ActionEvent actionEvent) { String port = (String) showInputDialog( logger, - "Select MTS port:", - dataSource.getName() + " Plugin Settings", + rb.getString("LPMAPORT"), + MessageFormat.format( + rb.getString("LPMAPORTTITLE"), dataSource.getName()), QUESTION_MESSAGE, null, getPorts(), @@ -59,14 +61,14 @@ public final class Lm2MtsPluginMenuAction extends AbstractAction { mts.disconnect(); int portCount = mts.portCount(); results = new String[portCount]; - results[0] = "-1 - [ no ports found ]"; + results[0] = rb.getString("LPMANOPORTS"); for (int i = 0; i < portCount; i++) { mts.currentPort(i); String name = mts.portName(); mts.connect(); int inputs = mts.inputCount(); - String result = String.format( - "%d - [ %s: %d sesnors ]", + String result = MessageFormat.format( + rb.getString("LPMAPORTS"), i, name, inputs); results[i] = result; mts.disconnect(); diff --git a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitPluginMenuAction.java b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitPluginMenuAction.java index 46b9ae64..792256ae 100644 --- a/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitPluginMenuAction.java +++ b/src/main/java/com/romraider/logger/external/phidget/interfacekit/plugin/IntfKitPluginMenuAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2013 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -145,11 +145,8 @@ public final class IntfKitPluginMenuAction extends AbstractAction { SettingsManager.getSettings().setPhidgetSensors(phidgets); JOptionPane.showMessageDialog( logger, - "Un-select each updated External Phidget data item on each Data,\n" + - "Graph and Dashboard Logger tabs to complete the update.\n\n" + - "Logging profiles using the old Phidget settings must be loaded\n" + - "and re-saved with the new settings.", - "Phidget InterfaceKit Settings Applied", - JOptionPane.INFORMATION_MESSAGE); + rb.getString("IPMAMSG"), + rb.getString("IPMAMSGTITLE"), + JOptionPane.INFORMATION_MESSAGE); } } diff --git a/src/main/java/com/romraider/swing/menubar/action/AboutAction.java b/src/main/java/com/romraider/swing/menubar/action/AboutAction.java index 92909029..95e50480 100644 --- a/src/main/java/com/romraider/swing/menubar/action/AboutAction.java +++ b/src/main/java/com/romraider/swing/menubar/action/AboutAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ import static javax.swing.JOptionPane.INFORMATION_MESSAGE; import static javax.swing.JOptionPane.showMessageDialog; import java.awt.event.ActionEvent; - +import java.text.MessageFormat; import com.romraider.Version; import com.romraider.logger.ecu.EcuLogger; @@ -34,14 +34,15 @@ public final class AboutAction extends AbstractAction { } public void actionPerformed(final ActionEvent actionEvent) { - final String message = String.format( - "%s - ECU Logger%nVersion: %s%nBuild #: %s%n%s%nLogger Def Version: %s", + final String message = MessageFormat.format( + rb.getString("VERSIONSTR"), Version.PRODUCT_NAME, Version.VERSION, Version.BUILDNUMBER, Version.SUPPORT_URL, logger.getDefVersion()); - final String title = "About " + Version.PRODUCT_NAME; + final String title = MessageFormat.format( + rb.getString("ABOUT"), Version.PRODUCT_NAME); showMessageDialog(logger, message, title, INFORMATION_MESSAGE, Version.ABOUT_ICON); } diff --git a/src/main/java/com/romraider/swing/menubar/action/AbstractAction.java b/src/main/java/com/romraider/swing/menubar/action/AbstractAction.java index d85baaf5..33cb5949 100644 --- a/src/main/java/com/romraider/swing/menubar/action/AbstractAction.java +++ b/src/main/java/com/romraider/swing/menubar/action/AbstractAction.java @@ -1,6 +1,6 @@ /* * RomRaider Open-Source Tuning, Logging and Reflashing - * Copyright (C) 2006-2012 RomRaider.com + * Copyright (C) 2006-2019 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,12 +20,17 @@ package com.romraider.swing.menubar.action; import com.romraider.logger.ecu.EcuLogger; +import com.romraider.util.ResourceUtil; + import javax.swing.Action; import java.beans.PropertyChangeListener; import java.util.HashMap; import java.util.Map; +import java.util.ResourceBundle; public abstract class AbstractAction implements Action { + protected static final ResourceBundle rb = new ResourceUtil().getBundle( + AbstractAction.class.getName()); public static final String SELECTED_KEY = "selected"; private final Map valueMap = new HashMap(); private boolean enabled = true;