diff --git a/G-Earth/src/main/java/gearth/GEarth.java b/G-Earth/src/main/java/gearth/GEarth.java index d5e859d..476b9ad 100644 --- a/G-Earth/src/main/java/gearth/GEarth.java +++ b/G-Earth/src/main/java/gearth/GEarth.java @@ -3,10 +3,8 @@ package gearth; import gearth.misc.AdminValidator; import gearth.misc.Cacher; import gearth.misc.UpdateChecker; -import gearth.misc.listenerpattern.Observable; import gearth.misc.listenerpattern.ObservableObject; import gearth.ui.GEarthController; -import gearth.ui.subforms.logger.loggerdisplays.PacketLogger; import gearth.ui.themes.Theme; import gearth.ui.themes.ThemeFactory; import gearth.ui.titlebar.TitleBarConfig; @@ -20,9 +18,6 @@ import javafx.scene.control.Alert; import javafx.scene.image.Image; import javafx.stage.Stage; import javafx.stage.StageStyle; -import sun.misc.Cache; - -import java.util.function.Consumer; public class GEarth extends Application { diff --git a/G-Earth/src/main/java/gearth/misc/AdminValidator.java b/G-Earth/src/main/java/gearth/misc/AdminValidator.java index 7a96735..8b1c81e 100644 --- a/G-Earth/src/main/java/gearth/misc/AdminValidator.java +++ b/G-Earth/src/main/java/gearth/misc/AdminValidator.java @@ -1,11 +1,11 @@ package gearth.misc; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; import javafx.scene.control.Label; -import javafx.scene.layout.Region; import java.io.IOException; import java.io.PrintStream; @@ -47,7 +47,7 @@ public class AdminValidator { if (!AdminValidator.isAdmin()) { Platform.runLater(() -> { Alert alert = new Alert(Alert.AlertType.WARNING, "", ButtonType.OK); - alert.getDialogPane().setContent(new Label("G-Earth needs admin privileges in order to work on Flash,\nplease restart G-Earth with admin permissions unless\nyou're using Unity")); + alert.getDialogPane().setContent(new Label(LanguageBundle.get("alert.adminvalidator.content").replaceAll("\\\\n", System.lineSeparator()))); try { TitleBarController.create(alert).showAlert(); } catch (IOException e) { diff --git a/G-Earth/src/main/java/gearth/misc/UpdateChecker.java b/G-Earth/src/main/java/gearth/misc/UpdateChecker.java index 93a0827..ec001b8 100644 --- a/G-Earth/src/main/java/gearth/misc/UpdateChecker.java +++ b/G-Earth/src/main/java/gearth/misc/UpdateChecker.java @@ -2,6 +2,7 @@ package gearth.misc; import gearth.GEarth; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; @@ -37,10 +38,10 @@ public class UpdateChecker { String body = (String)object.get("body"); boolean isForcedUpdate = body.contains("(!)"); - Alert alert = new Alert(isForcedUpdate ? Alert.AlertType.ERROR : Alert.AlertType.INFORMATION, "G-Earth is outdated!", ButtonType.OK); + Alert alert = new Alert(isForcedUpdate ? Alert.AlertType.ERROR : Alert.AlertType.INFORMATION, LanguageBundle.get("alert.outdated.title"), ButtonType.OK); FlowPane fp = new FlowPane(); - Label lbl = new Label("A new version of G-Earth has been found ("+gitv+")" + System.lineSeparator()+ System.lineSeparator() + "Update to the latest version:"); + Label lbl = new Label(LanguageBundle.get("alert.outdated.content.newversion") + " ("+gitv+")" + System.lineSeparator()+ System.lineSeparator() + LanguageBundle.get("alert.outdated.content.update") + ":"); Hyperlink link = new Hyperlink("https://github.com/sirjonasxx/G-Earth/releases"); fp.getChildren().addAll( lbl, link); link.setOnAction(event -> { @@ -51,7 +52,7 @@ public class UpdateChecker { WebView webView = new WebView(); - webView.getEngine().loadContent("A new version of G-Earth has been found ("+gitv+")

Update to the latest version:
https://github.com/sirjonasxx/G-Earth/releases"); + webView.getEngine().loadContent(String.format("%s (%s)

%s:
https://github.com/sirjonasxx/G-Earth/releases", LanguageBundle.get("alert.outdated.content.newversion"), gitv, LanguageBundle.get("alert.outdated.content.update"))); webView.setPrefSize(500, 200); alert.setResizable(false); diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java index 783f4d0..9070132 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java @@ -1,6 +1,5 @@ package gearth.protocol.connection.proxy; -import gearth.GEarth; import gearth.misc.Cacher; import gearth.misc.OSValidator; import gearth.protocol.HConnection; @@ -10,6 +9,7 @@ import gearth.protocol.connection.proxy.flash.NormalFlashProxyProvider; import gearth.protocol.connection.proxy.flash.unix.LinuxRawIpFlashProxyProvider; import gearth.protocol.connection.proxy.flash.windows.WindowsRawIpFlashProxyProvider; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; @@ -108,9 +108,7 @@ public class ProxyProviderFactory { Platform.runLater(() -> { Alert alert = new Alert(Alert.AlertType.ERROR, "", ButtonType.OK); - alert.getDialogPane().getChildren().add(new Label("G-Earth is already connected to this hotel.\n" + - "Due to current limitations you can only connect one session per hotel to G-Earth in Raw IP mode on Windows.\n\n" + - "You can bypass this by using a SOCKS proxy [Extra -> Advanced -> SOCKS]")); + alert.getDialogPane().getChildren().add(new Label(LanguageBundle.get("alert.alreadyconnected.content").replaceAll("\\\\n", System.lineSeparator()))); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(false); try { diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/FlashProxyProvider.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/FlashProxyProvider.java index dbbc7af..6df5f7a 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/FlashProxyProvider.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/flash/FlashProxyProvider.java @@ -1,6 +1,5 @@ package gearth.protocol.connection.proxy.flash; -import gearth.GEarth; import gearth.protocol.HConnection; import gearth.protocol.connection.HProxy; import gearth.protocol.connection.HProxySetter; @@ -12,6 +11,7 @@ import gearth.protocol.packethandler.flash.IncomingFlashPacketHandler; import gearth.protocol.packethandler.flash.OutgoingFlashPacketHandler; import gearth.protocol.packethandler.flash.FlashPacketHandler; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; @@ -126,7 +126,7 @@ public abstract class FlashProxyProvider implements ProxyProvider { protected void showInvalidConnectionError() { Platform.runLater(() -> { Alert alert = new Alert(Alert.AlertType.ERROR, "", ButtonType.OK); - alert.getDialogPane().getChildren().add(new Label("You entered invalid connection information, G-Earth could not connect")); + alert.getDialogPane().getChildren().add(new Label(LanguageBundle.get("alert.invalidconnection.content"))); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(false); try { diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/http/NitroHttpProxy.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/http/NitroHttpProxy.java index d5ef004..c0098f3 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/http/NitroHttpProxy.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/http/NitroHttpProxy.java @@ -5,6 +5,7 @@ import gearth.protocol.connection.proxy.nitro.NitroConstants; import gearth.protocol.connection.proxy.nitro.os.NitroOsFunctions; import gearth.protocol.connection.proxy.nitro.os.NitroOsFunctionsFactory; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; @@ -50,14 +51,12 @@ public class NitroHttpProxy { Platform.runLater(() -> { Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, ADMIN_WARNING_KEY, - "Root certificate installation", null, - "", "Remember my choice", + LanguageBundle.get("alert.rootcertificate.title"), null, + "", LanguageBundle.get("alert.rootcertificate.remember"), ButtonType.YES, ButtonType.NO ); - alert.getDialogPane().setContent(new Label("G-Earth detected that you do not have the root certificate authority installed.\n" + - "This is required for Nitro to work, do you want to continue?\n" + - "G-Earth will ask you for Administrator permission if you do so.")); + alert.getDialogPane().setContent(new Label(LanguageBundle.get("alert.rootcertificate.content").replaceAll("\\\\n", System.lineSeparator()))); try { shouldInstall.set(TitleBarController.create(alert).showAlertAndWait() diff --git a/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java b/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java index 50d37ad..616354c 100644 --- a/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java +++ b/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java @@ -10,6 +10,7 @@ import gearth.protocol.packethandler.PayloadBuffer; import gearth.protocol.packethandler.flash.BufferChangeListener; import gearth.protocol.packethandler.flash.FlashPacketHandler; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; @@ -72,10 +73,10 @@ public class Rc4Obtainer { System.err.println("COULD NOT FIND RC4 TABLE"); Platform.runLater(() -> { - Alert alert = new Alert(Alert.AlertType.WARNING, "Something went wrong!", ButtonType.OK); + Alert alert = new Alert(Alert.AlertType.WARNING, LanguageBundle.get("alert.somethingwentwrong.title"), ButtonType.OK); FlowPane fp = new FlowPane(); - Label lbl = new Label("G-Earth has experienced an issue" + System.lineSeparator() + System.lineSeparator() + "Head over to our Troubleshooting page to solve the problem:"); + Label lbl = new Label(LanguageBundle.get("alert.somethingwentwrong.content").replaceAll("\\\\n", System.lineSeparator())); Hyperlink link = new Hyperlink("https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting"); fp.getChildren().addAll(lbl, link); link.setOnAction(event -> { diff --git a/G-Earth/src/main/java/gearth/services/extension_handler/extensions/implementations/network/authentication/Authenticator.java b/G-Earth/src/main/java/gearth/services/extension_handler/extensions/implementations/network/authentication/Authenticator.java index 5f6b694..7c67f49 100644 --- a/G-Earth/src/main/java/gearth/services/extension_handler/extensions/implementations/network/authentication/Authenticator.java +++ b/G-Earth/src/main/java/gearth/services/extension_handler/extensions/implementations/network/authentication/Authenticator.java @@ -3,6 +3,7 @@ package gearth.services.extension_handler.extensions.implementations.network.aut import gearth.misc.ConfirmationDialog; import gearth.services.extension_handler.extensions.implementations.network.NetworkExtension; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; @@ -68,13 +69,12 @@ public class Authenticator { boolean[] done = {false}; Platform.runLater(() -> { Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, connectExtensionKey - ,"Confirmation Dialog", null, - "", "Remember my choice", + , LanguageBundle.get("alert.confirmation.windowtitle"), null, + "", LanguageBundle.get("alert.confirmation.button.remember"), ButtonType.YES, ButtonType.NO ); - alert.getDialogPane().setContent(new Label("Extension \""+extension.getTitle()+"\" tries to connect but isn't known to G-Earth,\n" + - "accept this connection?")); + alert.getDialogPane().setContent(new Label(String.format(LanguageBundle.get("alert.extconnection.content"), extension.getTitle()).replaceAll("\\\\n", System.lineSeparator()))); try { if (!(TitleBarController.create(alert).showAlertAndWait() diff --git a/G-Earth/src/main/java/gearth/services/g_python/GPythonShell.java b/G-Earth/src/main/java/gearth/services/g_python/GPythonShell.java index da92ac6..080ddb9 100644 --- a/G-Earth/src/main/java/gearth/services/g_python/GPythonShell.java +++ b/G-Earth/src/main/java/gearth/services/g_python/GPythonShell.java @@ -3,6 +3,7 @@ package gearth.services.g_python; import gearth.GEarth; import gearth.ui.subforms.extra.ExtraController; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; @@ -170,13 +171,11 @@ public class GPythonShell { private void showError() { Platform.runLater(() -> { - Alert alert = new Alert(Alert.AlertType.ERROR, "G-Python error", ButtonType.OK); - alert.setTitle("G-Python error"); + Alert alert = new Alert(Alert.AlertType.ERROR, LanguageBundle.get("alert.gpythonerror.title"), ButtonType.OK); + alert.setTitle(LanguageBundle.get("alert.gpythonerror.title")); FlowPane fp = new FlowPane(); - Label lbl = new Label("Something went wrong launching the G-Python shell," + - System.lineSeparator() + "are you sure you followed the installation guide correctly?" + - System.lineSeparator() + System.lineSeparator() + "More information here:"); + Label lbl = new Label(LanguageBundle.get("alert.gpythonerror.content").replaceAll("\\\\n", System.lineSeparator())); Hyperlink link = new Hyperlink(ExtraController.INFO_URL_GPYTHON); fp.getChildren().addAll(lbl, link); link.setOnAction(event -> { diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/GExtensionStoreController.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/GExtensionStoreController.java index f01de68..604f2d7 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/GExtensionStoreController.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/GExtensionStoreController.java @@ -24,6 +24,7 @@ import java.util.*; import java.util.function.Supplier; public class GExtensionStoreController implements Initializable { + private static GExtensionStoreController instance; private GExtensionStore extensionStore = null; @@ -38,6 +39,8 @@ public class GExtensionStoreController implements Initializable { @Override public void initialize(URL location, ResourceBundle resources) { + instance = this; + webView = new WebView(); borderPane.setCenter(webView); @@ -107,6 +110,7 @@ public class GExtensionStoreController implements Initializable { }); webView.getEngine().load(GExtensionStoreController.class.getResource("webview/index.html").toString()); + } @@ -237,4 +241,8 @@ public class GExtensionStoreController implements Initializable { public String getContentItemsContainer() { return contentItemsContainer; } + + public static void reloadPage() { + instance.webView.getEngine().reload(); + } } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/WebUtils.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/WebUtils.java index 7565b34..7e45109 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/WebUtils.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/WebUtils.java @@ -1,5 +1,7 @@ package gearth.services.internal_extensions.extensionstore.application; +import gearth.GEarth; +import gearth.ui.translations.LanguageBundle; import org.w3c.dom.Element; import java.time.LocalDateTime; @@ -43,19 +45,19 @@ public class WebUtils { } public static String elapsedTime(long time) { - if (time < 60) return time + (time == 1 ? " second" : " seconds"); + if (time < 60) return time + " " + LanguageBundle.get("ext.store.elapsedtime.second." + (time == 1 ? "single": "multiple")); time = time/60; - if (time < 60) return time + (time == 1 ? " minute" : " minutes"); + if (time < 60) return time + " " + LanguageBundle.get("ext.store.elapsedtime.minute." + (time == 1 ? "single": "multiple")); time = time/60; - if (time < 24) return time + (time == 1 ? " hour" : " hours"); + if (time < 24) return time + " " + LanguageBundle.get("ext.store.elapsedtime.hour." + (time == 1 ? "single": "multiple")); long days = time/24; - if (days < 7) return days + (days == 1 ? " day" : " days"); + if (days < 7) return days + " " + LanguageBundle.get("ext.store.elapsedtime.day." + (days == 1 ? "single": "multiple")); long weeks = days/7; - if (weeks < 6) return weeks + (weeks == 1 ? " week" : " weeks"); + if (weeks < 6) return weeks + " " + LanguageBundle.get("ext.store.elapsedtime.week." + (weeks == 1 ? "single": "multiple")); long months = days/31; - if (months < 12) return months + (months == 1 ? " month" : " months"); + if (months < 12) return months + " " + LanguageBundle.get("ext.store.elapsedtime.month." + (months == 1 ? "single": "multiple")); long years = days/365; - return years + (years == 1 ? " year" : " years"); + return years + " " + LanguageBundle.get("ext.store.elapsedtime.year." + (years == 1 ? "single": "multiple")); } public static String escapeMessage(String text) { diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/StoreExtensionItem.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/StoreExtensionItem.java index 45f7fd1..d859bbc 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/StoreExtensionItem.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/StoreExtensionItem.java @@ -1,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities; +import gearth.GEarth; import gearth.protocol.HMessage; import gearth.protocol.HPacket; import gearth.services.internal_extensions.extensionstore.GExtensionStore; @@ -9,6 +10,7 @@ import gearth.services.internal_extensions.extensionstore.application.entities.e import gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews.CategorizedOverview; import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; +import gearth.ui.translations.LanguageBundle; import netscape.javascript.JSObject; public class StoreExtensionItem implements ContentItem { @@ -56,12 +58,12 @@ public class StoreExtensionItem implements ContentItem { .append("
") .append("
").append(WebUtils.escapeMessage(storeExtension.getTitle())).append("
") - .append("
By ").append(storeExtension.getAuthors().get(0).getName()).append(", last updated ").append(WebUtils.elapsedSince(storeExtension.getUpdateDate())).append(" ago
") + .append("
").append(String.format(LanguageBundle.get("ext.store.extension.madeby"), storeExtension.getAuthors().get(0).getName())).append(", ").append(String.format(LanguageBundle.get("ext.store.extension.lastupdated"), WebUtils.elapsedSince(storeExtension.getUpdateDate()))).append("
") .append("
") .append("
") - .append("
").append("Version: ").append(displayVersion()).append("
") - .append("
").append("Rating: ").append(storeExtension.getRating()).append("
") + .append("
").append(LanguageBundle.get("ext.store.extension.version")).append(": ").append(displayVersion()).append("
") + .append("
").append(LanguageBundle.get("ext.store.extension.rating")).append(": ").append(storeExtension.getRating()).append("
") // .append("
").append(storeExtension.getFramework().getFramework().getName().replace("Native", "")).append("
") .append("
") diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/categories/CategoryItem.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/categories/CategoryItem.java index d998c3f..abf0a8c 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/categories/CategoryItem.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/categories/CategoryItem.java @@ -8,6 +8,7 @@ import gearth.services.internal_extensions.extensionstore.application.entities.q import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.models.ExtCategory; import gearth.services.internal_extensions.extensionstore.repository.querying.ExtensionOrdering; +import gearth.ui.translations.LanguageBundle; import netscape.javascript.JSObject; import java.util.Arrays; @@ -58,7 +59,7 @@ public class CategoryItem implements ContentItem { .append("") .append("
") - .append("
").append(releasesCount).append(" releases").append("
") + .append("
").append(releasesCount).append(" ").append(LanguageBundle.get("ext.store.extension.author.releases")).append("
") // .append("
").append(storeExtension.getFramework().getFramework().getName().replace("Native", "")).append("
") .append("
") diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/categories/CategoryOverview.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/categories/CategoryOverview.java index c773b4f..4222c75 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/categories/CategoryOverview.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/categories/CategoryOverview.java @@ -1,10 +1,12 @@ package gearth.services.internal_extensions.extensionstore.application.entities.categories; +import gearth.GEarth; import gearth.services.internal_extensions.extensionstore.GExtensionStore; import gearth.services.internal_extensions.extensionstore.application.entities.ContentItem; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.models.ExtCategory; +import gearth.ui.translations.LanguageBundle; import java.util.List; import java.util.stream.Collectors; @@ -57,17 +59,17 @@ public class CategoryOverview extends HOverview { @Override public String title() { - return "Categories"; + return LanguageBundle.get("ext.store.categories.title"); } @Override public String description() { - return "Explore the different kinds of extensions G-Earth has to offer"; + return LanguageBundle.get("ext.store.categories.description"); } @Override public String contentTitle() { - return "Categories"; + return LanguageBundle.get("ext.store.categories.contenttitle"); } }; } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/extensiondetails/StoreExtensionDetailsItem.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/extensiondetails/StoreExtensionDetailsItem.java index e4a335e..3668be0 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/extensiondetails/StoreExtensionDetailsItem.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/extensiondetails/StoreExtensionDetailsItem.java @@ -8,6 +8,7 @@ import gearth.services.internal_extensions.extensionstore.application.entities.H import gearth.services.internal_extensions.extensionstore.repository.models.ExtCategory; import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; import gearth.services.internal_extensions.extensionstore.tools.EncodingUtil; +import gearth.ui.translations.LanguageBundle; import netscape.javascript.JSObject; import org.apache.commons.io.IOUtils; import org.json.JSONObject; @@ -45,32 +46,32 @@ public class StoreExtensionDetailsItem implements ContentItem { contentBuilder .append(String.format("*%s*", storeExtension.getTitle())).append(" - v").append(storeExtension.getVersion()).append("\n\n") - .append("*Description*\n").append(descriptionQuoted).append("\n \n") - .append("*Author(s):* ").append(storeExtension.getAuthors().stream().map(StoreExtension.Author::getName).collect(Collectors.joining(", "))).append("\n\n") - .append("*Categories:* ").append(storeExtension.getCategories().stream().map(ExtCategory::getName).collect(Collectors.joining(", "))).append("\n\n"); + .append("*").append(LanguageBundle.get("ext.store.extension.details.description")).append(":*\n").append(descriptionQuoted).append("\n \n") + .append("*").append(LanguageBundle.get("ext.store.extension.details.authors")).append(":* ").append(storeExtension.getAuthors().stream().map(StoreExtension.Author::getName).collect(Collectors.joining(", "))).append("\n\n") + .append("*").append(LanguageBundle.get("ext.store.extension.details.categories")).append(":* ").append(storeExtension.getCategories().stream().map(ExtCategory::getName).collect(Collectors.joining(", "))).append("\n\n"); - contentBuilder.append("*Technical information*").append("\n"); + contentBuilder.append("*").append(LanguageBundle.get("ext.store.extension.details.technical_information")).append("*").append("\n"); if(storeExtension.getReleases() != null) - contentBuilder.append("> Releases: --url:Click Here-").append(storeExtension.getReleases()).append("\n"); + contentBuilder.append("> ").append(LanguageBundle.get("ext.store.extension.details.releases")).append(": --url:").append(LanguageBundle.get("ext.store.extension.details.click_here")).append("-").append(storeExtension.getReleases()).append("\n"); - contentBuilder.append("> Language: ").append(storeExtension.getLanguage()).append("\n") - .append("> Source: --url:Click Here-").append(storeExtension.getSource()).append("\n") - .append("> Framework: ").append(storeExtension.getFramework().getFramework().getName()).append(" - v").append(storeExtension.getFramework().getVersion()).append("\n") - .append("> Systems: ").append(String.join(", ", storeExtension.getCompatibility().getSystems())).append("\n \n"); + contentBuilder.append("> ").append(LanguageBundle.get("ext.store.extension.details.language")).append(": ").append(storeExtension.getLanguage()).append("\n") + .append("> ").append(LanguageBundle.get("ext.store.extension.details.source")).append(": --url:").append(LanguageBundle.get("ext.store.extension.details.click_here")).append("-").append(storeExtension.getSource()).append("\n") + .append("> ").append(LanguageBundle.get("ext.store.extension.details.framework")).append(": ").append(storeExtension.getFramework().getFramework().getName()).append(" - v").append(storeExtension.getFramework().getVersion()).append("\n") + .append("> ").append(LanguageBundle.get("ext.store.extension.details.systems")).append(": ").append(String.join(", ", storeExtension.getCompatibility().getSystems())).append("\n \n"); - contentBuilder.append("*Compatible clients:* ").append(String.join(", ", storeExtension.getCompatibility().getClients())).append("\n\n"); + contentBuilder.append("*").append(LanguageBundle.get("ext.store.extension.details.clients")).append(":* ").append(String.join(", ", storeExtension.getCompatibility().getClients())).append("\n\n"); if (storeExtension.getFramework().getFramework().isInstallationRequired()) { - contentBuilder.append("Warning: the framework requires --url:additional installations-") + contentBuilder.append(LanguageBundle.get("ext.store.extension.warning.requirement")) .append(storeExtension.getFramework().getFramework().getInstallationInstructions()).append(" !\n\n"); } if (!storeExtension.isStable()) { - contentBuilder.append("Warning: this extension has been marked unstable!\n\n"); + contentBuilder.append(LanguageBundle.get("ext.store.extension.warning.unstable")).append("\n\n"); } contentBuilder.append("--startdiv--") - .append("\n*Screenshot: *").append("\n") + .append("\n*").append(LanguageBundle.get("ext.store.extension.details.screenshot")).append(": *").append("\n") .append("--img:").append(gExtensionStore.getRepository().getResourceUrl("store", "extensions", storeExtension.getTitle(), "screenshot.png")) .append(" --enddiv--"); @@ -151,8 +152,8 @@ public class StoreExtensionDetailsItem implements ContentItem { .append("
") .append("
") .append("
").append(WebUtils.escapeMessage(mainAuthor.getName())).append("
") - .append("
").append(mainAuthor.getReputation()).append(" reputation
") - .append("
").append(mainAuthor.getExtensionsCount()).append(" releases
") + .append("
").append(mainAuthor.getReputation()).append(" ").append(LanguageBundle.get("ext.store.extension.author.reputation")).append("
") + .append("
").append(mainAuthor.getExtensionsCount()).append(" ").append(LanguageBundle.get("ext.store.extension.author.releases")).append("
") .append("
\"\"
") // todo look .append("
") .append("
").append(contentsInHtml()).append("
") diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/extensiondetails/StoreExtensionDetailsOverview.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/extensiondetails/StoreExtensionDetailsOverview.java index 7c06d56..de8b040 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/extensiondetails/StoreExtensionDetailsOverview.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/extensiondetails/StoreExtensionDetailsOverview.java @@ -1,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.extensiondetails; +import gearth.GEarth; import gearth.services.extension_handler.extensions.implementations.network.NetworkExtensionsProducer; import gearth.services.extension_handler.extensions.implementations.network.executer.NormalExtensionRunner; import gearth.services.internal_extensions.extensionstore.GExtensionStore; @@ -12,6 +13,7 @@ import gearth.services.internal_extensions.extensionstore.repository.models.Stor import gearth.services.internal_extensions.extensionstore.tools.InstalledExtension; import gearth.services.internal_extensions.extensionstore.tools.StoreExtensionTools; import gearth.ui.titlebar.TitleBarController; +import gearth.ui.translations.LanguageBundle; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; @@ -62,7 +64,7 @@ public class StoreExtensionDetailsOverview extends HOverview { public String buttonText() { int mode = mode(); // return mode == 2 ? "Update" : "Install"; - return mode == 0 ? "Install" : (mode == 1 ? "Installed" : "Update"); + return LanguageBundle.get("ext.store.button." + (mode == 0 ? "install" : (mode == 1 ? "installed" : "update"))); } @Override @@ -91,23 +93,23 @@ public class StoreExtensionDetailsOverview extends HOverview { private void awaitPopup(String mode) { popup(Alert.AlertType.WARNING, - String.format("%s extension", mode), - String.format("%s extension [%s]", mode, extension.getTitle()), - String.format("Press \"OK\" and wait while the extension is being %sed", mode.toLowerCase())); + LanguageBundle.get(String.format("ext.store.extension.status.await.%s", mode)), + String.format("%s [%s]", LanguageBundle.get(String.format("ext.store.extension.status.await.%s", mode)), extension.getTitle()), + LanguageBundle.get(String.format("ext.store.extension.status.await.%s.message", mode))); } private void successPopup(String mode) { popup(Alert.AlertType.INFORMATION, - String.format("%s completed", mode), - String.format("%s completed [%s]", mode, extension.getTitle()), - String.format("Extension %s completed successfully", mode.toLowerCase())); + LanguageBundle.get(String.format("ext.store.extension.status.success.%s", mode)), + String.format("%s [%s]", LanguageBundle.get(String.format("ext.store.extension.status.success.%s", mode)), extension.getTitle()), + LanguageBundle.get(String.format("ext.store.extension.status.success.%s.message", mode))); } private void errorPopup(String mode, String error) { popup(Alert.AlertType.ERROR, - String.format("%s failed", mode), - String.format("%s failed [%s]", mode, extension.getTitle()), - String.format("%s failed with the following message: %s", mode, error)); + LanguageBundle.get(String.format("ext.store.extension.status.success.%s", mode)), + String.format("%s [%s]", LanguageBundle.get(String.format("ext.store.extension.status.success.%s", mode)), extension.getTitle()), + String.format("%s: %s", LanguageBundle.get(String.format("ext.store.extension.status.success.%s.message", mode)), error)); } private void popup(Alert.AlertType alertType, String title, String header, String context) { @@ -128,7 +130,7 @@ public class StoreExtensionDetailsOverview extends HOverview { int mode = mode(); if (mode == 1) return; - String modeString = mode() == 0 ? "Install" : "Update"; + String modeString = mode() == 0 ? "install" : "update"; HOverview selff = this; StoreExtensionTools.InstallExtListener listener = new StoreExtensionTools.InstallExtListener() { diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/installed/InstalledOverview.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/installed/InstalledOverview.java index b64d1c2..4d0b10e 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/installed/InstalledOverview.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/installed/InstalledOverview.java @@ -7,6 +7,7 @@ import gearth.services.internal_extensions.extensionstore.repository.StoreReposi import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; import gearth.services.internal_extensions.extensionstore.tools.InstalledExtension; import gearth.services.internal_extensions.extensionstore.tools.StoreExtensionTools; +import gearth.ui.translations.LanguageBundle; import org.apache.maven.artifact.versioning.ComparableVersion; import java.awt.*; @@ -30,7 +31,7 @@ public class InstalledOverview extends HOverview { @Override public String buttonText() { - return "Open folder"; + return LanguageBundle.get("ext.store.overview.folder"); } @Override @@ -75,17 +76,17 @@ public class InstalledOverview extends HOverview { @Override public String title() { - return "Installed Extensions"; + return LanguageBundle.get("ext.store.overview.title"); } @Override public String description() { - return "Extensions that are already installed into G-Earth"; + return LanguageBundle.get("ext.store.overview.description"); } @Override public String contentTitle() { - return "Installed extensions"; + return LanguageBundle.get("ext.store.overview.contenttitle"); } }; } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/installed/StoreExtensionInstalledItem.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/installed/StoreExtensionInstalledItem.java index f5d6cda..84cb3ff 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/installed/StoreExtensionInstalledItem.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/installed/StoreExtensionInstalledItem.java @@ -6,6 +6,7 @@ import gearth.services.internal_extensions.extensionstore.application.WebUtils; import gearth.services.internal_extensions.extensionstore.application.entities.StoreExtensionItem; import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; import gearth.services.internal_extensions.extensionstore.tools.InstalledExtension; +import gearth.ui.translations.LanguageBundle; import org.apache.maven.artifact.versioning.ComparableVersion; public class StoreExtensionInstalledItem extends StoreExtensionItem { @@ -55,11 +56,11 @@ public class StoreExtensionInstalledItem extends StoreExtensionItem { .append("
") .append("
").append(WebUtils.escapeMessage(installedExtension.getName())).append("
") - .append("
Not found in G-ExtensionStore
") + .append("
").append(LanguageBundle.get("ext.store.extension.notinstore")).append("
") .append("
") .append("
") - .append("
").append("Version: ").append(displayVersion()).append("
") + .append("
").append(LanguageBundle.get("ext.store.extension.version")).append(": ").append(displayVersion()).append("
") .append("
") .append("
") diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByDateOverview.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByDateOverview.java index 1ea07db..acd0906 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByDateOverview.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByDateOverview.java @@ -1,11 +1,11 @@ package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews; import gearth.misc.OSValidator; -import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; import gearth.services.internal_extensions.extensionstore.repository.querying.ExtensionOrdering; +import gearth.ui.translations.LanguageBundle; import java.util.Collections; import java.util.List; @@ -32,17 +32,17 @@ public class ByDateOverview extends QueriedExtensionOverview { @Override public String title() { - return "New Releases"; + return LanguageBundle.get("ext.store.search.ordering.bydate.title"); } @Override public String description() { - return "Extensions that were recently added to the G-ExtensionStore"; + return LanguageBundle.get("ext.store.search.ordering.bydate.description"); } @Override public String contentTitle() { - return "New Releases"; + return LanguageBundle.get("ext.store.search.ordering.bydate.contenttitle"); } }; } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByRatingOverview.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByRatingOverview.java index bd080b9..de8d8d9 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByRatingOverview.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByRatingOverview.java @@ -1,11 +1,11 @@ package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews; import gearth.misc.OSValidator; -import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; import gearth.services.internal_extensions.extensionstore.repository.querying.ExtensionOrdering; +import gearth.ui.translations.LanguageBundle; import java.util.Collections; import java.util.List; @@ -32,17 +32,17 @@ public class ByRatingOverview extends QueriedExtensionOverview { @Override public String title() { - return "Popular Extensions"; + return LanguageBundle.get("ext.store.search.ordering.byrating.title"); } @Override public String description() { - return "Extensions sorted by rating"; + return LanguageBundle.get("ext.store.search.ordering.byrating.description"); } @Override public String contentTitle() { - return "Popular Extensions"; + return LanguageBundle.get("ext.store.search.ordering.byrating.contenttitle"); } }; } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByUpdateOverview.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByUpdateOverview.java index 36137ba..cb87d34 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByUpdateOverview.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/ByUpdateOverview.java @@ -5,6 +5,7 @@ import gearth.services.internal_extensions.extensionstore.application.entities.H import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; import gearth.services.internal_extensions.extensionstore.repository.querying.ExtensionOrdering; +import gearth.ui.translations.LanguageBundle; import java.util.Collections; import java.util.List; @@ -31,17 +32,17 @@ public class ByUpdateOverview extends QueriedExtensionOverview { @Override public String title() { - return "Recently Updated"; + return LanguageBundle.get("ext.store.search.ordering.byupdate.title"); } @Override public String description() { - return "Extensions that were recently updated"; + return LanguageBundle.get("ext.store.search.ordering.byupdate.description"); } @Override public String contentTitle() { - return "Recently Updated"; + return LanguageBundle.get("ext.store.search.ordering.byupdate.contenttitle"); } }; } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/CategorizedOverview.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/CategorizedOverview.java index e530256..3829d6c 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/CategorizedOverview.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/CategorizedOverview.java @@ -1,12 +1,12 @@ package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews; import gearth.misc.OSValidator; -import gearth.services.internal_extensions.extensionstore.application.WebUtils; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.models.ExtCategory; import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; import gearth.services.internal_extensions.extensionstore.repository.querying.ExtensionOrdering; +import gearth.ui.translations.LanguageBundle; import java.util.Collections; import java.util.List; @@ -47,7 +47,7 @@ public class CategorizedOverview extends QueriedExtensionOverview { @Override public String contentTitle() { - return "Category: " + category.getName(); + return LanguageBundle.get("ext.store.category") + ": " + category.getName(); } }; } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/SearchedQueryOverview.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/SearchedQueryOverview.java index 0709ced..cf951a9 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/SearchedQueryOverview.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/queriedoverviews/SearchedQueryOverview.java @@ -5,6 +5,7 @@ import gearth.services.internal_extensions.extensionstore.application.entities.H import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension; import gearth.services.internal_extensions.extensionstore.repository.querying.ExtensionOrdering; +import gearth.ui.translations.LanguageBundle; import java.util.Collections; import java.util.List; @@ -48,17 +49,17 @@ public class SearchedQueryOverview extends QueriedExtensionOverview { @Override public String title() { - return "Search"; + return LanguageBundle.get("ext.store.search.title"); } @Override public String description() { - return "Find the extension that fits your needs"; + return LanguageBundle.get("ext.store.search.description"); } @Override public String contentTitle() { - return "Search results"; + return LanguageBundle.get("ext.store.search.results"); } }; } diff --git a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/search/SearchComponent.java b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/search/SearchComponent.java index b53b3f1..a8f462f 100644 --- a/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/search/SearchComponent.java +++ b/G-Earth/src/main/java/gearth/services/internal_extensions/extensionstore/application/entities/search/SearchComponent.java @@ -1,10 +1,12 @@ package gearth.services.internal_extensions.extensionstore.application.entities.search; +import gearth.GEarth; import gearth.services.internal_extensions.extensionstore.GExtensionStore; import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController; import gearth.services.internal_extensions.extensionstore.application.entities.ContentItem; import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; import gearth.services.internal_extensions.extensionstore.repository.querying.ExtensionOrdering; +import gearth.ui.translations.LanguageBundle; import netscape.javascript.JSObject; import java.util.ArrayList; @@ -92,13 +94,13 @@ public class SearchComponent implements ContentItem { .append("
") .append("
") - .append("") + .append("") .append(String.format("", searchKeyword, id)) .append("
") .append("
") - .append(""); + .append(""); // add ordering stuff htmlBuilder.append(String.format(" -