[fixes #825] Add translation keys for update checking
This commit is contained in:
parent
de646e80a9
commit
581f0c4e2c
@ -333,9 +333,19 @@ generalprefs.lbl.languageEffect = The language will change the next time you sta
|
|||||||
! Software update checker
|
! Software update checker
|
||||||
update.dlg.error.title = Unable to retrieve update information
|
update.dlg.error.title = Unable to retrieve update information
|
||||||
update.dlg.error = An error occurred while communicating with the server.
|
update.dlg.error = An error occurred while communicating with the server.
|
||||||
|
update.dlg.exception.title = Could not check for updates
|
||||||
update.dlg.latestVersion.title = No updates available
|
update.dlg.latestVersion.title = No updates available
|
||||||
update.dlg.latestVersion = You are running the latest version of OpenRocket, version %s.
|
update.dlg.latestVersion = You are running the latest version of OpenRocket, version %s.
|
||||||
|
update.dlg.newerVersion.title = Newer version detected
|
||||||
|
update.dlg.newerVersion = You are either running a test/unofficial release of OpenRocket, or you have a time machine and are running an official release from the future.\n\nYour version: %s\nLatest official release: %s
|
||||||
|
update.dlg.updateAvailable.title = Update available
|
||||||
|
update.dlg.updateAvailable.txtPane.title = OpenRocket version %s available!
|
||||||
|
update.dlg.updateAvailable.txtPane.yourVersion = Your current version: %s
|
||||||
|
update.dlg.updateAvailable.txtPane.changelog = Changelog
|
||||||
|
update.dlg.updateAvailable.txtPane.readMore = Read more on GitHub
|
||||||
|
update.fetcher.badResponse = Bad response code from server: %d
|
||||||
|
update.fetcher.badConnection = Could not connect to the GitHub server. Please check your internet connection.
|
||||||
|
update.fetcher.malformedURL = Malformed URL: %s
|
||||||
|
|
||||||
! Simulation edit dialog
|
! Simulation edit dialog
|
||||||
simedtdlg.but.runsimulation = Run simulation
|
simedtdlg.but.runsimulation = Run simulation
|
||||||
|
@ -229,8 +229,8 @@ public class UpdateInfoRetriever {
|
|||||||
|
|
||||||
// Invalid response code
|
// Invalid response code
|
||||||
if (status != 200) {
|
if (status != 200) {
|
||||||
log.warn("Bad response code for update checker: " + status);
|
log.warn(String.format("Bad response code from server: %d", status));
|
||||||
throw new UpdateCheckerException("Bad response code for update checker: " + status); // TODO: replace by trans
|
throw new UpdateCheckerException(String.format(trans.get("update.fetcher.badResponse"), status));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the response JSON data into a StringBuilder
|
// Read the response JSON data into a StringBuilder
|
||||||
@ -257,12 +257,12 @@ public class UpdateInfoRetriever {
|
|||||||
}
|
}
|
||||||
} catch (UnknownHostException | SocketTimeoutException | ConnectException e) {
|
} catch (UnknownHostException | SocketTimeoutException | ConnectException e) {
|
||||||
log.warn(String.format("Could not connect to URL: %s. Please check your internet connection.", urlLink));
|
log.warn(String.format("Could not connect to URL: %s. Please check your internet connection.", urlLink));
|
||||||
throw new UpdateCheckerException("Could not connect to the GitHub server. Please check your internet connection."); // TODO: replace by trans
|
throw new UpdateCheckerException(trans.get("update.fetcher.badConnection"));
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
log.warn("Malformed URL for update checker: " + urlLink);
|
log.warn("Malformed URL: " + urlLink);
|
||||||
throw new UpdateCheckerException("Malformed URL for update checker: " + urlLink); // TODO: replace by trans
|
throw new UpdateCheckerException(String.format(trans.get("update.fetcher.malformedURL"), urlLink));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UpdateCheckerException(String.format("Exception - %s: %s", e, e.getMessage())); // TODO: replace by trans
|
throw new UpdateCheckerException(String.format("Exception - %s: %s", e, e.getMessage()));
|
||||||
} finally { // Close the connection to the release page
|
} finally { // Close the connection to the release page
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -41,7 +41,7 @@ public class UpdateInfoDialog extends JDialog {
|
|||||||
|
|
||||||
public UpdateInfoDialog(UpdateInfo info) {
|
public UpdateInfoDialog(UpdateInfo info) {
|
||||||
//// OpenRocket update available
|
//// OpenRocket update available
|
||||||
super(null, "Update OpenRocket", ModalityType.APPLICATION_MODAL); // TODO: replace with trans
|
super(null, trans.get("update.dlg.updateAvailable.title"), ModalityType.APPLICATION_MODAL);
|
||||||
|
|
||||||
JPanel panel = new JPanel(new MigLayout("fill"));
|
JPanel panel = new JPanel(new MigLayout("fill"));
|
||||||
|
|
||||||
@ -59,13 +59,13 @@ public class UpdateInfoDialog extends JDialog {
|
|||||||
|
|
||||||
// OpenRocket version available!
|
// OpenRocket version available!
|
||||||
sb.append("<html>");
|
sb.append("<html>");
|
||||||
sb.append(String.format("<h1>OpenRocket version %s available!</h1>", release.getReleaseName()));
|
sb.append(String.format("<h1>%s</h1>", String.format(trans.get("update.dlg.updateAvailable.txtPane.title"), release.getReleaseName())));
|
||||||
|
|
||||||
// Your version
|
// Your version
|
||||||
sb.append(String.format("<i>Your current version: %s </i> <br><br>", BuildProperties.getVersion()));
|
sb.append(String.format("<i>%s</i> <br><br>", String.format(trans.get("update.dlg.updateAvailable.txtPane.yourVersion"), BuildProperties.getVersion())));
|
||||||
|
|
||||||
// Changelog
|
// Changelog
|
||||||
sb.append("<h2>Changelog</h2>"); // TODO: replace with trans
|
sb.append(String.format("<h2>%s</h2>", trans.get("update.dlg.updateAvailable.txtPane.changelog")));
|
||||||
String releaseNotes = release.getReleaseNotes();
|
String releaseNotes = release.getReleaseNotes();
|
||||||
releaseNotes = releaseNotes.replaceAll("^\"|\"$", ""); // Remove leading and trailing quotations
|
releaseNotes = releaseNotes.replaceAll("^\"|\"$", ""); // Remove leading and trailing quotations
|
||||||
sb.append(MarkdownUtil.toHtml(releaseNotes)).append("<br><br>");
|
sb.append(MarkdownUtil.toHtml(releaseNotes)).append("<br><br>");
|
||||||
@ -73,7 +73,7 @@ public class UpdateInfoDialog extends JDialog {
|
|||||||
// GitHub link
|
// GitHub link
|
||||||
String releaseURL = release.getReleaseURL();
|
String releaseURL = release.getReleaseURL();
|
||||||
releaseURL = releaseURL.replaceAll("^\"|\"$", ""); // Remove leading and trailing quotations
|
releaseURL = releaseURL.replaceAll("^\"|\"$", ""); // Remove leading and trailing quotations
|
||||||
sb.append(String.format("<a href='%s'>Read more on GitHub</a>", releaseURL));
|
sb.append(String.format("<a href='%s'>%s</a>", releaseURL, trans.get("update.dlg.updateAvailable.txtPane.readMore")));
|
||||||
sb.append("</html>");
|
sb.append("</html>");
|
||||||
textPane.addHyperlinkListener(new HyperlinkListener() {
|
textPane.addHyperlinkListener(new HyperlinkListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -307,7 +307,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
|
|||||||
if (info.getException() != null) {
|
if (info.getException() != null) {
|
||||||
JOptionPane.showMessageDialog(this,
|
JOptionPane.showMessageDialog(this,
|
||||||
info.getException().getMessage(),
|
info.getException().getMessage(),
|
||||||
"Could not check for updates", JOptionPane.WARNING_MESSAGE, null); // TODO: replace by trans
|
trans.get("update.dlg.exception.title"), JOptionPane.WARNING_MESSAGE, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,11 +324,11 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
|
|||||||
break;
|
break;
|
||||||
case NEWER:
|
case NEWER:
|
||||||
JOptionPane.showMessageDialog(this,
|
JOptionPane.showMessageDialog(this,
|
||||||
//// You are running the latest version of OpenRocket.
|
//// You are running a newer version than the latest official release
|
||||||
String.format("<html><body><p style='width: %dpx'>%s", 400, String.format("You are either running a test/unofficial release of OpenRocket, or you have a time machine and are running an official release from the future.\n\nYour version: %s\nLatest official release: %s",
|
String.format("<html><body><p style='width: %dpx'>%s", 400, String.format(trans.get("update.dlg.newerVersion"),
|
||||||
BuildProperties.getVersion(), release.getReleaseName())), // TODO: trans
|
BuildProperties.getVersion(), release.getReleaseName())),
|
||||||
//// No updates available
|
//// Newer version detected
|
||||||
"Newer version", JOptionPane.INFORMATION_MESSAGE, null); // TODO: trans
|
trans.get("update.dlg.newerVersion.title"), JOptionPane.INFORMATION_MESSAGE, null);
|
||||||
break;
|
break;
|
||||||
case OLDER:
|
case OLDER:
|
||||||
UpdateInfoDialog infoDialog = new UpdateInfoDialog(info);
|
UpdateInfoDialog infoDialog = new UpdateInfoDialog(info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user