From ddb37d5fad714d5d7f27573b284bc4e83daa2a4e Mon Sep 17 00:00:00 2001 From: WiredSpast Date: Sat, 6 Aug 2022 00:56:27 +0200 Subject: [PATCH 01/29] Internationalization --- G-Earth/src/main/java/gearth/GEarth.java | 7 +- .../main/java/gearth/misc/AdminValidator.java | 3 +- .../main/java/gearth/misc/UpdateChecker.java | 6 +- .../proxy/ProxyProviderFactory.java | 4 +- .../proxy/flash/FlashProxyProvider.java | 2 +- .../proxy/nitro/http/NitroHttpProxy.java | 8 +- .../gearth/protocol/memory/Rc4Obtainer.java | 4 +- .../network/authentication/Authenticator.java | 8 +- .../services/g_python/GPythonShell.java | 8 +- .../GExtensionStoreController.java | 1 + .../extensionstore/application/WebUtils.java | 15 +- .../entities/StoreExtensionItem.java | 7 +- .../entities/categories/CategoryItem.java | 3 +- .../entities/categories/CategoryOverview.java | 7 +- .../StoreExtensionDetailsItem.java | 31 ++- .../StoreExtensionDetailsOverview.java | 23 +- .../entities/installed/InstalledOverview.java | 9 +- .../StoreExtensionInstalledItem.java | 5 +- .../queriedoverviews/ByDateOverview.java | 7 +- .../queriedoverviews/ByRatingOverview.java | 7 +- .../queriedoverviews/ByUpdateOverview.java | 7 +- .../queriedoverviews/CategorizedOverview.java | 3 +- .../SearchedQueryOverview.java | 7 +- .../entities/search/SearchComponent.java | 13 +- .../entities/search/SearchOverview.java | 9 +- .../connection/ConnectionController.java | 10 +- .../extensions/ExtensionItemContainer.java | 11 +- .../extensions/ExtensionsController.java | 7 +- .../extensions/logger/ExtensionLogger.java | 2 +- .../ui/subforms/extra/ExtraController.java | 9 +- .../ui/subforms/info/InfoController.java | 6 +- .../subforms/injection/InjectedPackets.java | 5 +- .../injection/InjectionController.java | 27 +- .../scheduler/SchedulerController.java | 19 +- .../src/main/resources/gearth/ui/G-Earth.fxml | 14 +- .../ui/subforms/connection/Connection.fxml | 26 +- .../ui/subforms/extensions/Extensions.fxml | 18 +- .../gearth/ui/subforms/extra/Extra.fxml | 22 +- .../gearth/ui/subforms/info/Info.fxml | 10 +- .../ui/subforms/injection/Injection.fxml | 14 +- .../ui/subforms/scheduler/Scheduler.fxml | 28 +- .../gearth/ui/subforms/tools/Tools.fxml | 16 +- .../ui/translations/messages.properties | 254 +++++++++++++++++ .../ui/translations/messages_de.properties | 256 ++++++++++++++++++ .../ui/translations/messages_es.properties | 256 ++++++++++++++++++ .../ui/translations/messages_fi.properties | 256 ++++++++++++++++++ .../ui/translations/messages_fr.properties | 256 ++++++++++++++++++ .../ui/translations/messages_it.properties | 256 ++++++++++++++++++ .../ui/translations/messages_nl.properties | 254 +++++++++++++++++ .../ui/translations/messages_pt.properties | 256 ++++++++++++++++++ .../ui/translations/messages_tr.properties | 256 ++++++++++++++++++ 51 files changed, 2539 insertions(+), 209 deletions(-) create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages.properties create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages_de.properties create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages_es.properties create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages_fi.properties create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages_fr.properties create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages_it.properties create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages_nl.properties create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages_pt.properties create mode 100644 G-Earth/src/main/resources/gearth/ui/translations/messages_tr.properties diff --git a/G-Earth/src/main/java/gearth/GEarth.java b/G-Earth/src/main/java/gearth/GEarth.java index 7982f9a..05fd10b 100644 --- a/G-Earth/src/main/java/gearth/GEarth.java +++ b/G-Earth/src/main/java/gearth/GEarth.java @@ -22,6 +22,8 @@ import javafx.stage.Stage; import javafx.stage.StageStyle; import sun.misc.Cache; +import java.util.Locale; +import java.util.ResourceBundle; import java.util.function.Consumer; public class GEarth extends Application { @@ -30,6 +32,7 @@ public class GEarth extends Application { public static String version = "1.5.2"; public static String gitApi = "https://api.github.com/repos/sirjonasxx/G-Earth/releases/latest"; public static ObservableObject observableTheme; + public static ResourceBundle translation; private Stage stage; private GEarthController controller; @@ -47,7 +50,9 @@ public class GEarth extends Application { main = this; stage = primaryStage; - FXMLLoader loader = new FXMLLoader(getClass().getResource("/gearth/ui/G-Earth.fxml")); + translation = ResourceBundle.getBundle("gearth.ui.translations.messages", new Locale("nl")); + + FXMLLoader loader = new FXMLLoader(getClass().getResource("/gearth/ui/G-Earth.fxml"), translation); Parent root = loader.load(); controller = loader.getController(); controller.setStage(primaryStage); diff --git a/G-Earth/src/main/java/gearth/misc/AdminValidator.java b/G-Earth/src/main/java/gearth/misc/AdminValidator.java index 7a96735..91300eb 100644 --- a/G-Earth/src/main/java/gearth/misc/AdminValidator.java +++ b/G-Earth/src/main/java/gearth/misc/AdminValidator.java @@ -1,5 +1,6 @@ package gearth.misc; +import gearth.GEarth; import gearth.ui.titlebar.TitleBarController; import javafx.application.Platform; import javafx.scene.control.Alert; @@ -47,7 +48,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(GEarth.translation.getString("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..4adb34c 100644 --- a/G-Earth/src/main/java/gearth/misc/UpdateChecker.java +++ b/G-Earth/src/main/java/gearth/misc/UpdateChecker.java @@ -37,10 +37,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, GEarth.translation.getString("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(GEarth.translation.getString("alert.outdated.content.newversion") + " ("+gitv+")" + System.lineSeparator()+ System.lineSeparator() + GEarth.translation.getString("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 +51,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", GEarth.translation.getString("alert.outdated.content.newversion"), gitv, GEarth.translation.getString("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..daf7c7a 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 @@ -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(GEarth.translation.getString("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..7ed7681 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 @@ -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(GEarth.translation.getString("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 f056564..4fcc833 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 @@ -53,14 +53,12 @@ public class NitroHttpProxy { Platform.runLater(() -> { Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, ADMIN_WARNING_KEY, - "Root certificate installation", null, - "", "Remember my choice", + GEarth.translation.getString("alert.rootcertificate.title"), null, + "", GEarth.translation.getString("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(GEarth.translation.getString("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..4797158 100644 --- a/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java +++ b/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java @@ -72,10 +72,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, GEarth.translation.getString("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(GEarth.translation.getString("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..1eb6946 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 @@ -1,5 +1,6 @@ package gearth.services.extension_handler.extensions.implementations.network.authentication; +import gearth.GEarth; import gearth.misc.ConfirmationDialog; import gearth.services.extension_handler.extensions.implementations.network.NetworkExtension; import gearth.ui.titlebar.TitleBarController; @@ -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", + , GEarth.translation.getString("alert.confirmation.windowtitle"), null, + "", GEarth.translation.getString("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(GEarth.translation.getString("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..a776f50 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 @@ -170,13 +170,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, GEarth.translation.getString("alert.gpythonerror.title"), ButtonType.OK); + alert.setTitle(GEarth.translation.getString("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(GEarth.translation.getString("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..297864a 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 @@ -107,6 +107,7 @@ public class GExtensionStoreController implements Initializable { }); webView.getEngine().load(GExtensionStoreController.class.getResource("webview/index.html").toString()); + } 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..8e3aa9d 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,6 @@ package gearth.services.internal_extensions.extensionstore.application; +import gearth.GEarth; import org.w3c.dom.Element; import java.time.LocalDateTime; @@ -43,19 +44,19 @@ public class WebUtils { } public static String elapsedTime(long time) { - if (time < 60) return time + (time == 1 ? " second" : " seconds"); + if (time < 60) return time + " " + GEarth.translation.getString("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 + " " + GEarth.translation.getString("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 + " " + GEarth.translation.getString("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 + " " + GEarth.translation.getString("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 + " " + GEarth.translation.getString("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 + " " + GEarth.translation.getString("ext.store.elapsedtime.month." + (months == 1 ? "single": "multiple")); long years = days/365; - return years + (years == 1 ? " year" : " years"); + return years + " " + GEarth.translation.getString("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..9a38348 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; @@ -56,12 +57,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(GEarth.translation.getString("ext.store.extension.madeby"), storeExtension.getAuthors().get(0).getName())).append(", ").append(String.format(GEarth.translation.getString("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(GEarth.translation.getString("ext.store.extension.version")).append(": ").append(displayVersion()).append("
") + .append("
").append(GEarth.translation.getString("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..55736fc 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 @@ -1,5 +1,6 @@ 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.GExtensionStoreController; import gearth.services.internal_extensions.extensionstore.application.WebUtils; @@ -58,7 +59,7 @@ public class CategoryItem implements ContentItem { .append("") .append("
") - .append("
").append(releasesCount).append(" releases").append("
") + .append("
").append(releasesCount).append(" ").append(GEarth.translation.getString("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..fc9eb9c 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,5 +1,6 @@ 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; @@ -57,17 +58,17 @@ public class CategoryOverview extends HOverview { @Override public String title() { - return "Categories"; + return GEarth.translation.getString("ext.store.categories.title"); } @Override public String description() { - return "Explore the different kinds of extensions G-Earth has to offer"; + return GEarth.translation.getString("ext.store.categories.description"); } @Override public String contentTitle() { - return "Categories"; + return GEarth.translation.getString("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..4d17e92 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 @@ -1,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.extensiondetails; +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.WebUtils; @@ -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(GEarth.translation.getString("ext.store.extension.details.description")).append(":*\n").append(descriptionQuoted).append("\n \n") + .append("*").append(GEarth.translation.getString("ext.store.extension.details.authors")).append(":* ").append(storeExtension.getAuthors().stream().map(StoreExtension.Author::getName).collect(Collectors.joining(", "))).append("\n\n") + .append("*").append(GEarth.translation.getString("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(GEarth.translation.getString("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(GEarth.translation.getString("ext.store.extension.details.releases")).append(": --url:").append(GEarth.translation.getString("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(GEarth.translation.getString("ext.store.extension.details.language")).append(": ").append(storeExtension.getLanguage()).append("\n") + .append("> ").append(GEarth.translation.getString("ext.store.extension.details.source")).append(": --url:").append(GEarth.translation.getString("ext.store.extension.details.click_here")).append("-").append(storeExtension.getSource()).append("\n") + .append("> ").append(GEarth.translation.getString("ext.store.extension.details.framework")).append(": ").append(storeExtension.getFramework().getFramework().getName()).append(" - v").append(storeExtension.getFramework().getVersion()).append("\n") + .append("> ").append(GEarth.translation.getString("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(GEarth.translation.getString("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(GEarth.translation.getString("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(GEarth.translation.getString("ext.store.extension.warning.unstable")).append("\n\n"); } contentBuilder.append("--startdiv--") - .append("\n*Screenshot: *").append("\n") + .append("\n*").append(GEarth.translation.getString("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(GEarth.translation.getString("ext.store.extension.author.reputation")).append("
") + .append("
").append(mainAuthor.getExtensionsCount()).append(" ").append(GEarth.translation.getString("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..8b0fad4 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; @@ -62,7 +63,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 GEarth.translation.getString("ext.store.button." + (mode == 0 ? "install" : (mode == 1 ? "installed" : "update"))); } @Override @@ -91,23 +92,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())); + GEarth.translation.getString(String.format("ext.store.extension.status.start.%s", mode)), + String.format("%s [%s]", GEarth.translation.getString(String.format("ext.store.extension.status.start.%s", mode)), extension.getTitle()), + GEarth.translation.getString(String.format("ext.store.extension.status.start.%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())); + GEarth.translation.getString(String.format("ext.store.extension.status.success.%s", mode)), + String.format("%s [%s]", GEarth.translation.getString(String.format("ext.store.extension.status.success.%s", mode)), extension.getTitle()), + GEarth.translation.getString(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)); + GEarth.translation.getString(String.format("ext.store.extension.status.success.%s", mode)), + String.format("%s [%s]", GEarth.translation.getString(String.format("ext.store.extension.status.success.%s", mode)), extension.getTitle()), + String.format("%s: %s", GEarth.translation.getString(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 +129,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..6e7886c 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 @@ -1,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.installed; +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; @@ -30,7 +31,7 @@ public class InstalledOverview extends HOverview { @Override public String buttonText() { - return "Open folder"; + return GEarth.translation.getString("ext.store.overview.folder"); } @Override @@ -75,17 +76,17 @@ public class InstalledOverview extends HOverview { @Override public String title() { - return "Installed Extensions"; + return GEarth.translation.getString("ext.store.overview.title"); } @Override public String description() { - return "Extensions that are already installed into G-Earth"; + return GEarth.translation.getString("ext.store.overview.description"); } @Override public String contentTitle() { - return "Installed extensions"; + return GEarth.translation.getString("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..7d54bd0 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 @@ -1,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.installed; +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.WebUtils; @@ -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(GEarth.translation.getString("ext.store.extension.notinstore")).append("
") .append("
") .append("
") - .append("
").append("Version: ").append(displayVersion()).append("
") + .append("
").append(GEarth.translation.getString("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..ab321ae 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,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews; +import gearth.GEarth; import gearth.misc.OSValidator; import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; @@ -32,17 +33,17 @@ public class ByDateOverview extends QueriedExtensionOverview { @Override public String title() { - return "New Releases"; + return GEarth.translation.getString("ext.store.search.ordering.bydate.title"); } @Override public String description() { - return "Extensions that were recently added to the G-ExtensionStore"; + return GEarth.translation.getString("ext.store.search.ordering.bydate.description"); } @Override public String contentTitle() { - return "New Releases"; + return GEarth.translation.getString("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..fa3f9e1 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,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews; +import gearth.GEarth; import gearth.misc.OSValidator; import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; @@ -32,17 +33,17 @@ public class ByRatingOverview extends QueriedExtensionOverview { @Override public String title() { - return "Popular Extensions"; + return GEarth.translation.getString("ext.store.search.ordering.byrating.title"); } @Override public String description() { - return "Extensions sorted by rating"; + return GEarth.translation.getString("ext.store.search.ordering.byrating.description"); } @Override public String contentTitle() { - return "Popular Extensions"; + return GEarth.translation.getString("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..83629ec 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 @@ -1,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews; +import gearth.GEarth; import gearth.misc.OSValidator; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; @@ -31,17 +32,17 @@ public class ByUpdateOverview extends QueriedExtensionOverview { @Override public String title() { - return "Recently Updated"; + return GEarth.translation.getString("ext.store.search.ordering.byupdate.title"); } @Override public String description() { - return "Extensions that were recently updated"; + return GEarth.translation.getString("ext.store.search.ordering.byupdate.description"); } @Override public String contentTitle() { - return "Recently Updated"; + return GEarth.translation.getString("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..3f1b695 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,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews; +import gearth.GEarth; import gearth.misc.OSValidator; import gearth.services.internal_extensions.extensionstore.application.WebUtils; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; @@ -47,7 +48,7 @@ public class CategorizedOverview extends QueriedExtensionOverview { @Override public String contentTitle() { - return "Category: " + category.getName(); + return GEarth.translation.getString("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..2226602 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 @@ -1,5 +1,6 @@ package gearth.services.internal_extensions.extensionstore.application.entities.queriedoverviews; +import gearth.GEarth; import gearth.misc.OSValidator; import gearth.services.internal_extensions.extensionstore.application.entities.HOverview; import gearth.services.internal_extensions.extensionstore.repository.StoreRepository; @@ -48,17 +49,17 @@ public class SearchedQueryOverview extends QueriedExtensionOverview { @Override public String title() { - return "Search"; + return GEarth.translation.getString("ext.store.search.title"); } @Override public String description() { - return "Find the extension that fits your needs"; + return GEarth.translation.getString("ext.store.search.description"); } @Override public String contentTitle() { - return "Search results"; + return GEarth.translation.getString("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..d50800f 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,5 +1,6 @@ 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; @@ -92,13 +93,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(" -