Move i18n things to util.i18n package
This commit is contained in:
@@ -21,7 +21,7 @@ import com.jfoenix.concurrency.JFXUtilities;
|
|||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.jackhuang.hmcl.setting.Settings;
|
|
||||||
import org.jackhuang.hmcl.task.Schedulers;
|
import org.jackhuang.hmcl.task.Schedulers;
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.ui.Controllers;
|
import org.jackhuang.hmcl.ui.Controllers;
|
||||||
@@ -37,9 +37,7 @@ import java.net.URLClassLoader;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ResourceBundle;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public final class Launcher extends Application {
|
public final class Launcher extends Application {
|
||||||
|
|
||||||
@@ -139,19 +137,6 @@ public final class Launcher extends Application {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String i18n(String key) {
|
|
||||||
try {
|
|
||||||
return RESOURCE_BUNDLE.getString(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logging.LOG.log(Level.SEVERE, "Cannot find key " + key + " in resource bundle", e);
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String i18n(String key, Object... formatArgs) {
|
|
||||||
return String.format(i18n(key), formatArgs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final File MINECRAFT_DIRECTORY = OperatingSystem.getWorkingDirectory("minecraft");
|
public static final File MINECRAFT_DIRECTORY = OperatingSystem.getWorkingDirectory("minecraft");
|
||||||
public static final File HMCL_DIRECTORY = OperatingSystem.getWorkingDirectory("hmcl");
|
public static final File HMCL_DIRECTORY = OperatingSystem.getWorkingDirectory("hmcl");
|
||||||
public static final File LOG_DIRECTORY = new File(Launcher.HMCL_DIRECTORY, "logs");
|
public static final File LOG_DIRECTORY = new File(Launcher.HMCL_DIRECTORY, "logs");
|
||||||
@@ -159,7 +144,6 @@ public final class Launcher extends Application {
|
|||||||
public static final String VERSION = System.getProperty("hmcl.version.override", "@HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING@");
|
public static final String VERSION = System.getProperty("hmcl.version.override", "@HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING@");
|
||||||
public static final String NAME = "HMCL";
|
public static final String NAME = "HMCL";
|
||||||
public static final String TITLE = NAME + " " + VERSION;
|
public static final String TITLE = NAME + " " + VERSION;
|
||||||
public static final ResourceBundle RESOURCE_BUNDLE = Settings.INSTANCE.getLocale().getResourceBundle();
|
|
||||||
public static final UpdateChecker UPDATE_CHECKER = new UpdateChecker(VersionNumber.asVersion(VERSION));
|
public static final UpdateChecker UPDATE_CHECKER = new UpdateChecker(VersionNumber.asVersion(VERSION));
|
||||||
public static final IUpgrader UPGRADER = new AppDataUpgrader();
|
public static final IUpgrader UPGRADER = new AppDataUpgrader();
|
||||||
public static final CrashReporter CRASH_REPORTER = new CrashReporter();
|
public static final CrashReporter CRASH_REPORTER = new CrashReporter();
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ import org.jackhuang.hmcl.ui.LogWindow;
|
|||||||
import org.jackhuang.hmcl.ui.construct.MessageBox;
|
import org.jackhuang.hmcl.ui.construct.MessageBox;
|
||||||
import org.jackhuang.hmcl.ui.construct.TaskExecutorDialogPane;
|
import org.jackhuang.hmcl.ui.construct.TaskExecutorDialogPane;
|
||||||
import org.jackhuang.hmcl.util.*;
|
import org.jackhuang.hmcl.util.*;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18nException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -106,7 +108,7 @@ public final class LauncherHelper {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(Task.of(Schedulers.javafx(), () -> emitStatus(LoadingState.LOGGING_IN)))
|
.then(Task.of(Schedulers.javafx(), () -> emitStatus(LoadingState.LOGGING_IN)))
|
||||||
.then(Task.of(Launcher.i18n("account.methods"), variables -> {
|
.then(Task.of(I18n.i18n("account.methods"), variables -> {
|
||||||
try {
|
try {
|
||||||
variables.set("account", account.logIn());
|
variables.set("account", account.logIn());
|
||||||
} catch (CredentialExpiredException e) {
|
} catch (CredentialExpiredException e) {
|
||||||
@@ -131,12 +133,12 @@ public final class LauncherHelper {
|
|||||||
.then(variables -> {
|
.then(variables -> {
|
||||||
DefaultLauncher launcher = variables.get("launcher");
|
DefaultLauncher launcher = variables.get("launcher");
|
||||||
if (scriptFile == null) {
|
if (scriptFile == null) {
|
||||||
return new LaunchTask<>(launcher::launch).setName(Launcher.i18n("version.launch"));
|
return new LaunchTask<>(launcher::launch).setName(I18n.i18n("version.launch"));
|
||||||
} else {
|
} else {
|
||||||
return new LaunchTask<>(() -> {
|
return new LaunchTask<>(() -> {
|
||||||
launcher.makeLaunchScript(scriptFile);
|
launcher.makeLaunchScript(scriptFile);
|
||||||
return null;
|
return null;
|
||||||
}).setName(Launcher.i18n("version.launch_script"));
|
}).setName(I18n.i18n("version.launch_script"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(Task.of(variables -> {
|
.then(Task.of(variables -> {
|
||||||
@@ -153,7 +155,7 @@ public final class LauncherHelper {
|
|||||||
} else
|
} else
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
Controllers.closeDialog(launchingStepsPane);
|
Controllers.closeDialog(launchingStepsPane);
|
||||||
Controllers.dialog(Launcher.i18n("version.launch_script.success", scriptFile.getAbsolutePath()));
|
Controllers.dialog(I18n.i18n("version.launch_script.success", scriptFile.getAbsolutePath()));
|
||||||
});
|
});
|
||||||
|
|
||||||
}))
|
}))
|
||||||
@@ -182,11 +184,11 @@ public final class LauncherHelper {
|
|||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
String message;
|
String message;
|
||||||
if (ex instanceof CurseCompletionException)
|
if (ex instanceof CurseCompletionException)
|
||||||
message = Launcher.i18n("modpack.type.curse.error");
|
message = I18n.i18n("modpack.type.curse.error");
|
||||||
else
|
else
|
||||||
message = I18nException.getStackTrace(ex);
|
message = I18nException.getStackTrace(ex);
|
||||||
Controllers.dialog(message,
|
Controllers.dialog(message,
|
||||||
scriptFile == null ? Launcher.i18n("launch.failed") : Launcher.i18n("version.launch_script.failed"),
|
scriptFile == null ? I18n.i18n("launch.failed") : I18n.i18n("version.launch_script.failed"),
|
||||||
MessageBox.ERROR_MESSAGE);
|
MessageBox.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +209,7 @@ public final class LauncherHelper {
|
|||||||
VersionNumber gameVersion = VersionNumber.asVersion(GameVersion.minecraftVersion(profile.getRepository().getVersionJar(version)).orElse("Unknown"));
|
VersionNumber gameVersion = VersionNumber.asVersion(GameVersion.minecraftVersion(profile.getRepository().getVersionJar(version)).orElse("Unknown"));
|
||||||
JavaVersion java = setting.getJavaVersion();
|
JavaVersion java = setting.getJavaVersion();
|
||||||
if (java == null) {
|
if (java == null) {
|
||||||
Controllers.dialog(Launcher.i18n("launch.wrong_javadir"), Launcher.i18n("message.error"), MessageBox.WARNING_MESSAGE, onAccept);
|
Controllers.dialog(I18n.i18n("launch.wrong_javadir"), I18n.i18n("message.error"), MessageBox.WARNING_MESSAGE, onAccept);
|
||||||
setting.setJava(null);
|
setting.setJava(null);
|
||||||
setting.setDefaultJavaPath(null);
|
setting.setDefaultJavaPath(null);
|
||||||
java = JavaVersion.fromCurrentEnvironment();
|
java = JavaVersion.fromCurrentEnvironment();
|
||||||
@@ -218,10 +220,10 @@ public final class LauncherHelper {
|
|||||||
if (gameVersion.compareTo(VersionNumber.asVersion("1.13")) >= 0) {
|
if (gameVersion.compareTo(VersionNumber.asVersion("1.13")) >= 0) {
|
||||||
// Minecraft 1.13 and later versions only support Java 8 or later.
|
// Minecraft 1.13 and later versions only support Java 8 or later.
|
||||||
// Terminate launching operation.
|
// Terminate launching operation.
|
||||||
Controllers.dialog(Launcher.i18n("launch.advice.java8_1_13"), Launcher.i18n("message.error"), MessageBox.ERROR_MESSAGE, null);
|
Controllers.dialog(I18n.i18n("launch.advice.java8_1_13"), I18n.i18n("message.error"), MessageBox.ERROR_MESSAGE, null);
|
||||||
} else {
|
} else {
|
||||||
// Most mods require Java 8 or later version.
|
// Most mods require Java 8 or later version.
|
||||||
Controllers.dialog(Launcher.i18n("launch.advice.newer_java"), Launcher.i18n("message.error"), MessageBox.WARNING_MESSAGE, onAccept);
|
Controllers.dialog(I18n.i18n("launch.advice.newer_java"), I18n.i18n("message.error"), MessageBox.WARNING_MESSAGE, onAccept);
|
||||||
}
|
}
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
@@ -229,24 +231,24 @@ public final class LauncherHelper {
|
|||||||
// LaunchWrapper will crash because of assuming the system class loader is an instance of URLClassLoader.
|
// LaunchWrapper will crash because of assuming the system class loader is an instance of URLClassLoader.
|
||||||
// cpw has claimed that he will make MinecraftForge of 1.13 and later versions able to run on Java 9.
|
// cpw has claimed that he will make MinecraftForge of 1.13 and later versions able to run on Java 9.
|
||||||
if (!flag && java.getParsedVersion() >= JavaVersion.JAVA_9 && gameVersion.compareTo(VersionNumber.asVersion("1.12.5")) < 0 && version.getMainClass().contains("launchwrapper")) {
|
if (!flag && java.getParsedVersion() >= JavaVersion.JAVA_9 && gameVersion.compareTo(VersionNumber.asVersion("1.12.5")) < 0 && version.getMainClass().contains("launchwrapper")) {
|
||||||
Controllers.dialog(Launcher.i18n("launch.advice.java9"), Launcher.i18n("message.error"), MessageBox.ERROR_MESSAGE, null);
|
Controllers.dialog(I18n.i18n("launch.advice.java9"), I18n.i18n("message.error"), MessageBox.ERROR_MESSAGE, null);
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flag && java.getPlatform() == org.jackhuang.hmcl.util.Platform.BIT_32 &&
|
if (!flag && java.getPlatform() == org.jackhuang.hmcl.util.Platform.BIT_32 &&
|
||||||
org.jackhuang.hmcl.util.Platform.IS_64_BIT) {
|
org.jackhuang.hmcl.util.Platform.IS_64_BIT) {
|
||||||
Controllers.dialog(Launcher.i18n("launch.advice.different_platform"), Launcher.i18n("message.error"), MessageBox.ERROR_MESSAGE, onAccept);
|
Controllers.dialog(I18n.i18n("launch.advice.different_platform"), I18n.i18n("message.error"), MessageBox.ERROR_MESSAGE, onAccept);
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
if (!flag && java.getPlatform() == org.jackhuang.hmcl.util.Platform.BIT_32 &&
|
if (!flag && java.getPlatform() == org.jackhuang.hmcl.util.Platform.BIT_32 &&
|
||||||
setting.getMaxMemory() > 1.5 * 1024) {
|
setting.getMaxMemory() > 1.5 * 1024) {
|
||||||
// 1.5 * 1024 is an inaccurate number.
|
// 1.5 * 1024 is an inaccurate number.
|
||||||
// Actual memory limit depends on operating system and memory.
|
// Actual memory limit depends on operating system and memory.
|
||||||
Controllers.dialog(Launcher.i18n("launch.advice.too_large_memory_for_32bit"), Launcher.i18n("message.error"), MessageBox.ERROR_MESSAGE, onAccept);
|
Controllers.dialog(I18n.i18n("launch.advice.too_large_memory_for_32bit"), I18n.i18n("message.error"), MessageBox.ERROR_MESSAGE, onAccept);
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
if (!flag && OperatingSystem.TOTAL_MEMORY > 0 && OperatingSystem.TOTAL_MEMORY < setting.getMaxMemory()) {
|
if (!flag && OperatingSystem.TOTAL_MEMORY > 0 && OperatingSystem.TOTAL_MEMORY < setting.getMaxMemory()) {
|
||||||
Controllers.dialog(Launcher.i18n("launch.advice.not_enough_space", OperatingSystem.TOTAL_MEMORY), Launcher.i18n("message.error"), MessageBox.ERROR_MESSAGE, onAccept);
|
Controllers.dialog(I18n.i18n("launch.advice.not_enough_space", OperatingSystem.TOTAL_MEMORY), I18n.i18n("message.error"), MessageBox.ERROR_MESSAGE, onAccept);
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,11 +302,11 @@ public final class LauncherHelper {
|
|||||||
try {
|
try {
|
||||||
setResult(supplier.get());
|
setResult(supplier.get());
|
||||||
} catch (PermissionException e) {
|
} catch (PermissionException e) {
|
||||||
throw new I18nException(Launcher.i18n("launch.failed.executable_permission"), e);
|
throw new I18nException(I18n.i18n("launch.failed.executable_permission"), e);
|
||||||
} catch (ProcessCreationException e) {
|
} catch (ProcessCreationException e) {
|
||||||
throw new I18nException(Launcher.i18n("launch.failed.creating_process") + e.getLocalizedMessage(), e);
|
throw new I18nException(I18n.i18n("launch.failed.creating_process") + e.getLocalizedMessage(), e);
|
||||||
} catch (NotDecompressingNativesException e) {
|
} catch (NotDecompressingNativesException e) {
|
||||||
throw new I18nException(Launcher.i18n("launch.failed.decompressing_natives") + e.getLocalizedMessage(), e);
|
throw new I18nException(I18n.i18n("launch.failed.decompressing_natives") + e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,10 +426,10 @@ public final class LauncherHelper {
|
|||||||
|
|
||||||
switch (exitType) {
|
switch (exitType) {
|
||||||
case JVM_ERROR:
|
case JVM_ERROR:
|
||||||
logWindow.setTitle(Launcher.i18n("launch.failed.cannot_create_jvm"));
|
logWindow.setTitle(I18n.i18n("launch.failed.cannot_create_jvm"));
|
||||||
break;
|
break;
|
||||||
case APPLICATION_ERROR:
|
case APPLICATION_ERROR:
|
||||||
logWindow.setTitle(Launcher.i18n("launch.failed.exited_abnormally"));
|
logWindow.setTitle(I18n.i18n("launch.failed.exited_abnormally"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.game;
|
package org.jackhuang.hmcl.game;
|
||||||
|
|
||||||
import org.jackhuang.hmcl.Launcher;
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
public enum LoadingState {
|
public enum LoadingState {
|
||||||
DEPENDENCIES("launch.state.dependencies"),
|
DEPENDENCIES("launch.state.dependencies"),
|
||||||
@@ -33,6 +33,6 @@ public enum LoadingState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalizedMessage() {
|
public String getLocalizedMessage() {
|
||||||
return Launcher.i18n(key);
|
return I18n.i18n(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.setting;
|
package org.jackhuang.hmcl.setting;
|
||||||
|
|
||||||
import org.jackhuang.hmcl.Launcher;
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
public final class Profiles {
|
public final class Profiles {
|
||||||
|
|
||||||
@@ -30,9 +30,9 @@ public final class Profiles {
|
|||||||
public static String getProfileDisplayName(Profile profile) {
|
public static String getProfileDisplayName(Profile profile) {
|
||||||
switch (profile.getName()) {
|
switch (profile.getName()) {
|
||||||
case Profiles.DEFAULT_PROFILE:
|
case Profiles.DEFAULT_PROFILE:
|
||||||
return Launcher.i18n("profile.default");
|
return I18n.i18n("profile.default");
|
||||||
case Profiles.HOME_PROFILE:
|
case Profiles.HOME_PROFILE:
|
||||||
return Launcher.i18n("profile.home");
|
return I18n.i18n("profile.home");
|
||||||
default:
|
default:
|
||||||
return profile.getName();
|
return profile.getName();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import org.jackhuang.hmcl.download.DownloadProvider;
|
|||||||
import org.jackhuang.hmcl.event.*;
|
import org.jackhuang.hmcl.event.*;
|
||||||
import org.jackhuang.hmcl.task.Schedulers;
|
import org.jackhuang.hmcl.task.Schedulers;
|
||||||
import org.jackhuang.hmcl.util.*;
|
import org.jackhuang.hmcl.util.*;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.Locales;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.auth.Account;
|
import org.jackhuang.hmcl.auth.Account;
|
||||||
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
||||||
import org.jackhuang.hmcl.auth.offline.OfflineAccount;
|
import org.jackhuang.hmcl.auth.offline.OfflineAccount;
|
||||||
@@ -39,6 +39,7 @@ import org.jackhuang.hmcl.setting.Theme;
|
|||||||
import org.jackhuang.hmcl.task.Schedulers;
|
import org.jackhuang.hmcl.task.Schedulers;
|
||||||
import org.jackhuang.hmcl.ui.construct.ComponentList;
|
import org.jackhuang.hmcl.ui.construct.ComponentList;
|
||||||
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ public class AccountPage extends StackPane implements DecoratorPage {
|
|||||||
this.account = account;
|
this.account = account;
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
|
||||||
title = new SimpleStringProperty(this, "title", Launcher.i18n("account") + " - " + account.getCharacter());
|
title = new SimpleStringProperty(this, "title", I18n.i18n("account") + " - " + account.getCharacter());
|
||||||
|
|
||||||
FXUtils.loadFXML(this, "/assets/fxml/account.fxml");
|
FXUtils.loadFXML(this, "/assets/fxml/account.fxml");
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import javafx.scene.layout.BorderPane;
|
|||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.auth.*;
|
import org.jackhuang.hmcl.auth.*;
|
||||||
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
||||||
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer;
|
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer;
|
||||||
@@ -49,6 +49,7 @@ import org.jackhuang.hmcl.ui.construct.SpinnerPane;
|
|||||||
import org.jackhuang.hmcl.ui.construct.Validator;
|
import org.jackhuang.hmcl.ui.construct.Validator;
|
||||||
import org.jackhuang.hmcl.util.Constants;
|
import org.jackhuang.hmcl.util.Constants;
|
||||||
import org.jackhuang.hmcl.util.Logging;
|
import org.jackhuang.hmcl.util.Logging;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.ui.FXUtils.jfxListCellFactory;
|
import static org.jackhuang.hmcl.ui.FXUtils.jfxListCellFactory;
|
||||||
import static org.jackhuang.hmcl.ui.FXUtils.stringConverter;
|
import static org.jackhuang.hmcl.ui.FXUtils.stringConverter;
|
||||||
@@ -82,13 +83,13 @@ public class AddAccountPane extends StackPane {
|
|||||||
cboServers.setCellFactory(jfxListCellFactory(server -> new TwoLineListItem(server.getName(), server.getUrl())));
|
cboServers.setCellFactory(jfxListCellFactory(server -> new TwoLineListItem(server.getName(), server.getUrl())));
|
||||||
cboServers.setConverter(stringConverter(AuthlibInjectorServer::getName));
|
cboServers.setConverter(stringConverter(AuthlibInjectorServer::getName));
|
||||||
cboServers.setItems(Settings.SETTINGS.authlibInjectorServers);
|
cboServers.setItems(Settings.SETTINGS.authlibInjectorServers);
|
||||||
cboServers.setPromptText(Launcher.i18n("general.prompt.empty"));
|
cboServers.setPromptText(I18n.i18n("general.prompt.empty"));
|
||||||
|
|
||||||
// workaround: otherwise the combox will be black
|
// workaround: otherwise the combox will be black
|
||||||
if (!cboServers.getItems().isEmpty())
|
if (!cboServers.getItems().isEmpty())
|
||||||
cboServers.getSelectionModel().select(0);
|
cboServers.getSelectionModel().select(0);
|
||||||
|
|
||||||
cboType.getItems().setAll(Launcher.i18n("account.methods.offline"), Launcher.i18n("account.methods.yggdrasil"), Launcher.i18n("account.methods.authlib_injector"));
|
cboType.getItems().setAll(I18n.i18n("account.methods.offline"), I18n.i18n("account.methods.yggdrasil"), I18n.i18n("account.methods.authlib_injector"));
|
||||||
cboType.getSelectionModel().selectedIndexProperty().addListener((a, b, newValue) -> {
|
cboType.getSelectionModel().selectedIndexProperty().addListener((a, b, newValue) -> {
|
||||||
txtPassword.setVisible(newValue.intValue() != 0);
|
txtPassword.setVisible(newValue.intValue() != 0);
|
||||||
lblPassword.setVisible(newValue.intValue() != 0);
|
lblPassword.setVisible(newValue.intValue() != 0);
|
||||||
@@ -101,7 +102,7 @@ public class AddAccountPane extends StackPane {
|
|||||||
|
|
||||||
txtPassword.setOnAction(e -> onCreationAccept());
|
txtPassword.setOnAction(e -> onCreationAccept());
|
||||||
txtUsername.setOnAction(e -> onCreationAccept());
|
txtUsername.setOnAction(e -> onCreationAccept());
|
||||||
txtUsername.getValidators().add(new Validator(Launcher.i18n("input.email"), str -> !txtPassword.isVisible() || str.contains("@")));
|
txtUsername.getValidators().add(new Validator(I18n.i18n("input.email"), str -> !txtPassword.isVisible() || str.contains("@")));
|
||||||
|
|
||||||
txtUsername.textProperty().addListener(it -> validateAcceptButton());
|
txtUsername.textProperty().addListener(it -> validateAcceptButton());
|
||||||
txtPassword.textProperty().addListener(it -> validateAcceptButton());
|
txtPassword.textProperty().addListener(it -> validateAcceptButton());
|
||||||
@@ -134,7 +135,7 @@ public class AddAccountPane extends StackPane {
|
|||||||
if (server.isPresent()) {
|
if (server.isPresent()) {
|
||||||
addtionalData = server.get();
|
addtionalData = server.get();
|
||||||
} else {
|
} else {
|
||||||
lblCreationWarning.setText(Launcher.i18n("account.failed.no_selected_server"));
|
lblCreationWarning.setText(I18n.i18n("account.failed.no_selected_server"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -189,11 +190,11 @@ public class AddAccountPane extends StackPane {
|
|||||||
{
|
{
|
||||||
setStyle("-fx-padding: 8px;");
|
setStyle("-fx-padding: 8px;");
|
||||||
|
|
||||||
cancel.setText(Launcher.i18n("button.cancel"));
|
cancel.setText(I18n.i18n("button.cancel"));
|
||||||
StackPane.setAlignment(cancel, Pos.BOTTOM_RIGHT);
|
StackPane.setAlignment(cancel, Pos.BOTTOM_RIGHT);
|
||||||
cancel.setOnMouseClicked(e -> latch.countDown());
|
cancel.setOnMouseClicked(e -> latch.countDown());
|
||||||
|
|
||||||
listBox.startCategory(Launcher.i18n("account.choose"));
|
listBox.startCategory(I18n.i18n("account.choose"));
|
||||||
|
|
||||||
setCenter(listBox);
|
setCenter(listBox);
|
||||||
|
|
||||||
@@ -254,19 +255,19 @@ public class AddAccountPane extends StackPane {
|
|||||||
|
|
||||||
public static String accountException(Exception exception) {
|
public static String accountException(Exception exception) {
|
||||||
if (exception instanceof NoCharacterException) {
|
if (exception instanceof NoCharacterException) {
|
||||||
return Launcher.i18n("account.failed.no_character");
|
return I18n.i18n("account.failed.no_character");
|
||||||
} else if (exception instanceof ServerDisconnectException) {
|
} else if (exception instanceof ServerDisconnectException) {
|
||||||
return Launcher.i18n("account.failed.connect_authentication_server");
|
return I18n.i18n("account.failed.connect_authentication_server");
|
||||||
} else if (exception instanceof RemoteAuthenticationException) {
|
} else if (exception instanceof RemoteAuthenticationException) {
|
||||||
RemoteAuthenticationException remoteException = (RemoteAuthenticationException) exception;
|
RemoteAuthenticationException remoteException = (RemoteAuthenticationException) exception;
|
||||||
String remoteMessage = remoteException.getRemoteMessage();
|
String remoteMessage = remoteException.getRemoteMessage();
|
||||||
if ("ForbiddenOperationException".equals(remoteException.getRemoteName()) && remoteMessage != null) {
|
if ("ForbiddenOperationException".equals(remoteException.getRemoteName()) && remoteMessage != null) {
|
||||||
if (remoteMessage.contains("Invalid credentials"))
|
if (remoteMessage.contains("Invalid credentials"))
|
||||||
return Launcher.i18n("account.failed.invalid_credentials");
|
return I18n.i18n("account.failed.invalid_credentials");
|
||||||
else if (remoteMessage.contains("Invalid token"))
|
else if (remoteMessage.contains("Invalid token"))
|
||||||
return Launcher.i18n("account.failed.invalid_token");
|
return I18n.i18n("account.failed.invalid_token");
|
||||||
else if (remoteMessage.contains("Invalid username or password"))
|
else if (remoteMessage.contains("Invalid username or password"))
|
||||||
return Launcher.i18n("account.failed.invalid_password");
|
return I18n.i18n("account.failed.invalid_password");
|
||||||
}
|
}
|
||||||
return exception.getMessage();
|
return exception.getMessage();
|
||||||
} else {
|
} else {
|
||||||
@@ -275,9 +276,9 @@ public class AddAccountPane extends StackPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String accountType(Account account) {
|
public static String accountType(Account account) {
|
||||||
if (account instanceof OfflineAccount) return Launcher.i18n("account.methods.offline");
|
if (account instanceof OfflineAccount) return I18n.i18n("account.methods.offline");
|
||||||
else if (account instanceof AuthlibInjectorAccount) return Launcher.i18n("account.methods.authlib_injector");
|
else if (account instanceof AuthlibInjectorAccount) return I18n.i18n("account.methods.authlib_injector");
|
||||||
else if (account instanceof YggdrasilAccount) return Launcher.i18n("account.methods.yggdrasil");
|
else if (account instanceof YggdrasilAccount) return I18n.i18n("account.methods.yggdrasil");
|
||||||
else throw new Error(Launcher.i18n("account.methods.no_method") + ": " + account);
|
else throw new Error(I18n.i18n("account.methods.no_method") + ": " + account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer;
|
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer;
|
||||||
import org.jackhuang.hmcl.setting.Settings;
|
import org.jackhuang.hmcl.setting.Settings;
|
||||||
import org.jackhuang.hmcl.task.Schedulers;
|
import org.jackhuang.hmcl.task.Schedulers;
|
||||||
@@ -18,13 +18,14 @@ import org.jackhuang.hmcl.ui.animation.TransitionHandler;
|
|||||||
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
|
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
|
||||||
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
||||||
import org.jackhuang.hmcl.util.NetworkUtils;
|
import org.jackhuang.hmcl.util.NetworkUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toList;
|
import static java.util.stream.Collectors.toList;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class AuthlibInjectorServersPage extends StackPane implements DecoratorPage {
|
public class AuthlibInjectorServersPage extends StackPane implements DecoratorPage {
|
||||||
private final StringProperty title = new SimpleStringProperty(this, "title", Launcher.i18n("account.injector.server"));
|
private final StringProperty title = new SimpleStringProperty(this, "title", I18n.i18n("account.injector.server"));
|
||||||
|
|
||||||
@FXML private ScrollPane scrollPane;
|
@FXML private ScrollPane scrollPane;
|
||||||
@FXML private StackPane addServerContainer;
|
@FXML private StackPane addServerContainer;
|
||||||
@@ -153,7 +154,7 @@ public class AuthlibInjectorServersPage extends StackPane implements DecoratorPa
|
|||||||
|
|
||||||
private String resolveFetchExceptionMessage(Throwable exception) {
|
private String resolveFetchExceptionMessage(Throwable exception) {
|
||||||
if (exception instanceof IOException) {
|
if (exception instanceof IOException) {
|
||||||
return Launcher.i18n("account.failed.connect_injector_server");
|
return I18n.i18n("account.failed.connect_injector_server");
|
||||||
} else {
|
} else {
|
||||||
return exception.getClass() + ": " + exception.getLocalizedMessage();
|
return exception.getClass() + ": " + exception.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import javafx.scene.layout.HBox;
|
|||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
import org.jackhuang.hmcl.Launcher;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author huangyuhui
|
* @author huangyuhui
|
||||||
@@ -37,9 +38,9 @@ public class CrashWindow extends Stage {
|
|||||||
public CrashWindow(String text) {
|
public CrashWindow(String text) {
|
||||||
Label lblCrash = new Label();
|
Label lblCrash = new Label();
|
||||||
if (Launcher.UPDATE_CHECKER.isOutOfDate())
|
if (Launcher.UPDATE_CHECKER.isOutOfDate())
|
||||||
lblCrash.setText(Launcher.i18n("launcher.crash_out_dated"));
|
lblCrash.setText(I18n.i18n("launcher.crash_out_dated"));
|
||||||
else
|
else
|
||||||
lblCrash.setText(Launcher.i18n("launcher.crash"));
|
lblCrash.setText(I18n.i18n("launcher.crash"));
|
||||||
lblCrash.setWrapText(true);
|
lblCrash.setWrapText(true);
|
||||||
|
|
||||||
TextArea textArea = new TextArea();
|
TextArea textArea = new TextArea();
|
||||||
@@ -47,7 +48,7 @@ public class CrashWindow extends Stage {
|
|||||||
textArea.setEditable(false);
|
textArea.setEditable(false);
|
||||||
|
|
||||||
Button btnContact = new Button();
|
Button btnContact = new Button();
|
||||||
btnContact.setText(Launcher.i18n("launcher.contact"));
|
btnContact.setText(I18n.i18n("launcher.contact"));
|
||||||
btnContact.setOnMouseClicked(event -> FXUtils.openLink(Launcher.CONTACT));
|
btnContact.setOnMouseClicked(event -> FXUtils.openLink(Launcher.CONTACT));
|
||||||
HBox box = new HBox();
|
HBox box = new HBox();
|
||||||
box.setStyle("-fx-padding: 8px;");
|
box.setStyle("-fx-padding: 8px;");
|
||||||
@@ -65,7 +66,7 @@ public class CrashWindow extends Stage {
|
|||||||
Scene scene = new Scene(pane, 800, 480);
|
Scene scene = new Scene(pane, 800, 480);
|
||||||
setScene(scene);
|
setScene(scene);
|
||||||
getIcons().add(new Image("/assets/img/icon.png"));
|
getIcons().add(new Image("/assets/img/icon.png"));
|
||||||
setTitle(Launcher.i18n("message.error"));
|
setTitle(I18n.i18n("message.error"));
|
||||||
|
|
||||||
setOnCloseRequest(e -> System.exit(1));
|
setOnCloseRequest(e -> System.exit(1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ import javafx.stage.StageStyle;
|
|||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
import org.jackhuang.hmcl.Launcher;
|
||||||
import org.jackhuang.hmcl.setting.EnumBackgroundImage;
|
import org.jackhuang.hmcl.setting.EnumBackgroundImage;
|
||||||
import org.jackhuang.hmcl.setting.Locales;
|
|
||||||
import org.jackhuang.hmcl.setting.Settings;
|
import org.jackhuang.hmcl.setting.Settings;
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
import org.jackhuang.hmcl.ui.animation.AnimationProducer;
|
import org.jackhuang.hmcl.ui.animation.AnimationProducer;
|
||||||
@@ -66,6 +65,7 @@ import org.jackhuang.hmcl.ui.wizard.*;
|
|||||||
import org.jackhuang.hmcl.util.FileUtils;
|
import org.jackhuang.hmcl.util.FileUtils;
|
||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
import org.jackhuang.hmcl.util.StringUtils;
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.Locales;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ import javafx.util.Callback;
|
|||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.util.*;
|
import org.jackhuang.hmcl.util.*;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -203,7 +203,7 @@ public final class FXUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void loadFXML(Node node, String absolutePath) {
|
public static void loadFXML(Node node, String absolutePath) {
|
||||||
FXMLLoader loader = new FXMLLoader(node.getClass().getResource(absolutePath), Launcher.RESOURCE_BUNDLE);
|
FXMLLoader loader = new FXMLLoader(node.getClass().getResource(absolutePath), I18n.RESOURCE_BUNDLE);
|
||||||
loader.setRoot(node);
|
loader.setRoot(node);
|
||||||
loader.setController(node);
|
loader.setController(node);
|
||||||
Lang.invoke((ExceptionalSupplier<Object, IOException>) loader::load);
|
Lang.invoke((ExceptionalSupplier<Object, IOException>) loader::load);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package org.jackhuang.hmcl.ui;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.download.MaintainTask;
|
import org.jackhuang.hmcl.download.MaintainTask;
|
||||||
import org.jackhuang.hmcl.download.game.VersionJsonSaveTask;
|
import org.jackhuang.hmcl.download.game.VersionJsonSaveTask;
|
||||||
import org.jackhuang.hmcl.game.GameVersion;
|
import org.jackhuang.hmcl.game.GameVersion;
|
||||||
@@ -30,6 +30,7 @@ import org.jackhuang.hmcl.setting.Profile;
|
|||||||
import org.jackhuang.hmcl.task.Schedulers;
|
import org.jackhuang.hmcl.task.Schedulers;
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.ui.download.InstallerWizardProvider;
|
import org.jackhuang.hmcl.ui.download.InstallerWizardProvider;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -90,7 +91,7 @@ public class InstallerController {
|
|||||||
Optional<String> gameVersion = GameVersion.minecraftVersion(profile.getRepository().getVersionJar(version));
|
Optional<String> gameVersion = GameVersion.minecraftVersion(profile.getRepository().getVersionJar(version));
|
||||||
|
|
||||||
if (!gameVersion.isPresent())
|
if (!gameVersion.isPresent())
|
||||||
Controllers.dialog(Launcher.i18n("version.cannot_read"));
|
Controllers.dialog(I18n.i18n("version.cannot_read"));
|
||||||
else
|
else
|
||||||
Controllers.getDecorator().startWizard(new InstallerWizardProvider(profile, gameVersion.get(), version, forge, liteLoader, optiFine));
|
Controllers.getDecorator().startWizard(new InstallerWizardProvider(profile, gameVersion.get(), version, forge, liteLoader, optiFine));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,11 @@ import com.jfoenix.effects.JFXDepthManager;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author huangyuhui
|
* @author huangyuhui
|
||||||
*/
|
*/
|
||||||
@@ -44,7 +45,7 @@ public class InstallerItem extends BorderPane {
|
|||||||
setStyle("-fx-background-radius: 2; -fx-background-color: white; -fx-padding: 8;");
|
setStyle("-fx-background-radius: 2; -fx-background-color: white; -fx-padding: 8;");
|
||||||
JFXDepthManager.setDepth(this, 1);
|
JFXDepthManager.setDepth(this, 1);
|
||||||
lblInstallerArtifact.setText(artifact);
|
lblInstallerArtifact.setText(artifact);
|
||||||
lblInstallerVersion.setText(Launcher.i18n("archive.version") + ": " + version);
|
lblInstallerVersion.setText(I18n.i18n("archive.version") + ": " + version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import javafx.scene.input.MouseButton;
|
|||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.auth.Account;
|
import org.jackhuang.hmcl.auth.Account;
|
||||||
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
||||||
import org.jackhuang.hmcl.auth.offline.OfflineAccount;
|
import org.jackhuang.hmcl.auth.offline.OfflineAccount;
|
||||||
@@ -49,6 +49,7 @@ import org.jackhuang.hmcl.ui.construct.ClassTitle;
|
|||||||
import org.jackhuang.hmcl.ui.construct.IconedItem;
|
import org.jackhuang.hmcl.ui.construct.IconedItem;
|
||||||
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
|
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
|
||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -61,27 +62,27 @@ public final class LeftPaneController {
|
|||||||
private final VBox profilePane = new VBox();
|
private final VBox profilePane = new VBox();
|
||||||
private final VBox accountPane = new VBox();
|
private final VBox accountPane = new VBox();
|
||||||
private final IconedItem launcherSettingsItem;
|
private final IconedItem launcherSettingsItem;
|
||||||
private final VersionListItem missingAccountItem = new VersionListItem(Launcher.i18n("account.missing"), Launcher.i18n("message.unknown"));
|
private final VersionListItem missingAccountItem = new VersionListItem(I18n.i18n("account.missing"), I18n.i18n("message.unknown"));
|
||||||
private final HashMap<Account, VersionListItem> items = new HashMap<>();
|
private final HashMap<Account, VersionListItem> items = new HashMap<>();
|
||||||
|
|
||||||
public LeftPaneController(AdvancedListBox leftPane) {
|
public LeftPaneController(AdvancedListBox leftPane) {
|
||||||
this.leftPane = leftPane;
|
this.leftPane = leftPane;
|
||||||
|
|
||||||
this.launcherSettingsItem = Lang.apply(new IconedItem(SVG.gear(Theme.blackFillBinding(), 20, 20), Launcher.i18n("settings.launcher")), iconedItem -> {
|
this.launcherSettingsItem = Lang.apply(new IconedItem(SVG.gear(Theme.blackFillBinding(), 20, 20), I18n.i18n("settings.launcher")), iconedItem -> {
|
||||||
iconedItem.prefWidthProperty().bind(leftPane.widthProperty());
|
iconedItem.prefWidthProperty().bind(leftPane.widthProperty());
|
||||||
iconedItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage()));
|
iconedItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage()));
|
||||||
});
|
});
|
||||||
|
|
||||||
leftPane
|
leftPane
|
||||||
.add(new ClassTitle(Launcher.i18n("account").toUpperCase(), Lang.apply(new JFXButton(), button -> {
|
.add(new ClassTitle(I18n.i18n("account").toUpperCase(), Lang.apply(new JFXButton(), button -> {
|
||||||
button.setGraphic(SVG.plus(Theme.blackFillBinding(), 10, 10));
|
button.setGraphic(SVG.plus(Theme.blackFillBinding(), 10, 10));
|
||||||
button.getStyleClass().add("toggle-icon-tiny");
|
button.getStyleClass().add("toggle-icon-tiny");
|
||||||
button.setOnMouseClicked(e -> addNewAccount());
|
button.setOnMouseClicked(e -> addNewAccount());
|
||||||
})))
|
})))
|
||||||
.add(accountPane)
|
.add(accountPane)
|
||||||
.startCategory(Launcher.i18n("launcher").toUpperCase())
|
.startCategory(I18n.i18n("launcher").toUpperCase())
|
||||||
.add(launcherSettingsItem)
|
.add(launcherSettingsItem)
|
||||||
.add(new ClassTitle(Launcher.i18n("profile.title").toUpperCase(), Lang.apply(new JFXButton(), button -> {
|
.add(new ClassTitle(I18n.i18n("profile.title").toUpperCase(), Lang.apply(new JFXButton(), button -> {
|
||||||
button.setGraphic(SVG.plus(Theme.blackFillBinding(), 10, 10));
|
button.setGraphic(SVG.plus(Theme.blackFillBinding(), 10, 10));
|
||||||
button.getStyleClass().add("toggle-icon-tiny");
|
button.getStyleClass().add("toggle-icon-tiny");
|
||||||
button.setOnMouseClicked(e ->
|
button.setOnMouseClicked(e ->
|
||||||
@@ -122,7 +123,7 @@ public final class LeftPaneController {
|
|||||||
if (node instanceof RipplerContainer && node.getProperties().get("profile") instanceof String) {
|
if (node instanceof RipplerContainer && node.getProperties().get("profile") instanceof String) {
|
||||||
boolean current = Objects.equals(node.getProperties().get("profile"), profile.getName());
|
boolean current = Objects.equals(node.getProperties().get("profile"), profile.getName());
|
||||||
((RipplerContainer) node).setSelected(current);
|
((RipplerContainer) node).setSelected(current);
|
||||||
((VersionListItem) ((RipplerContainer) node).getContainer()).setGameVersion(current ? Launcher.i18n("profile.selected") : "");
|
((VersionListItem) ((RipplerContainer) node).getContainer()).setGameVersion(current ? I18n.i18n("profile.selected") : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -143,9 +144,9 @@ public final class LeftPaneController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String accountType(Account account) {
|
private static String accountType(Account account) {
|
||||||
if (account instanceof OfflineAccount) return Launcher.i18n("account.methods.offline");
|
if (account instanceof OfflineAccount) return I18n.i18n("account.methods.offline");
|
||||||
else if (account instanceof YggdrasilAccount) return account.getUsername();
|
else if (account instanceof YggdrasilAccount) return account.getUsername();
|
||||||
else throw new Error(Launcher.i18n("account.methods.no_method") + ": " + account);
|
else throw new Error(I18n.i18n("account.methods.no_method") + ": " + account);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onAccountAdd(AccountAddedEvent event) {
|
private void onAccountAdd(AccountAddedEvent event) {
|
||||||
@@ -207,7 +208,7 @@ public final class LeftPaneController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showUpdate() {
|
public void showUpdate() {
|
||||||
launcherSettingsItem.setText(Launcher.i18n("update.found"));
|
launcherSettingsItem.setText(I18n.i18n("update.found"));
|
||||||
launcherSettingsItem.setTextFill(Color.RED);
|
launcherSettingsItem.setTextFill(Color.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +232,7 @@ public final class LeftPaneController {
|
|||||||
Controllers.closeDialog(region.get());
|
Controllers.closeDialog(region.get());
|
||||||
checkAccount();
|
checkAccount();
|
||||||
})).executor();
|
})).executor();
|
||||||
region.set(Controllers.taskDialog(executor, Launcher.i18n("modpack.installing"), ""));
|
region.set(Controllers.taskDialog(executor, I18n.i18n("modpack.installing"), ""));
|
||||||
executor.start();
|
executor.start();
|
||||||
showNewAccount = false;
|
showNewAccount = false;
|
||||||
} catch (UnsupportedModpackException ignore) {
|
} catch (UnsupportedModpackException ignore) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import javafx.scene.layout.StackPane;
|
|||||||
import javafx.scene.web.WebEngine;
|
import javafx.scene.web.WebEngine;
|
||||||
import javafx.scene.web.WebView;
|
import javafx.scene.web.WebView;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.event.Event;
|
import org.jackhuang.hmcl.event.Event;
|
||||||
import org.jackhuang.hmcl.event.EventManager;
|
import org.jackhuang.hmcl.event.EventManager;
|
||||||
import org.jackhuang.hmcl.game.LauncherHelper;
|
import org.jackhuang.hmcl.game.LauncherHelper;
|
||||||
@@ -39,6 +39,7 @@ import org.jackhuang.hmcl.util.IOUtils;
|
|||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
import org.jackhuang.hmcl.util.Log4jLevel;
|
import org.jackhuang.hmcl.util.Log4jLevel;
|
||||||
import org.jackhuang.hmcl.util.StringUtils;
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
@@ -63,7 +64,7 @@ public final class LogWindow extends Stage {
|
|||||||
public LogWindow() {
|
public LogWindow() {
|
||||||
setScene(new Scene(impl, 800, 480));
|
setScene(new Scene(impl, 800, 480));
|
||||||
getScene().getStylesheets().addAll(Settings.INSTANCE.getTheme().getStylesheets());
|
getScene().getStylesheets().addAll(Settings.INSTANCE.getTheme().getStylesheets());
|
||||||
setTitle(Launcher.i18n("logwindow.title"));
|
setTitle(I18n.i18n("logwindow.title"));
|
||||||
getIcons().add(new Image("/assets/img/icon.png"));
|
getIcons().add(new Image("/assets/img/icon.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import javafx.scene.input.MouseButton;
|
|||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.event.EventBus;
|
import org.jackhuang.hmcl.event.EventBus;
|
||||||
import org.jackhuang.hmcl.event.ProfileChangedEvent;
|
import org.jackhuang.hmcl.event.ProfileChangedEvent;
|
||||||
import org.jackhuang.hmcl.event.RefreshedVersionsEvent;
|
import org.jackhuang.hmcl.event.RefreshedVersionsEvent;
|
||||||
@@ -47,6 +47,7 @@ import org.jackhuang.hmcl.ui.download.DownloadWizardProvider;
|
|||||||
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
import org.jackhuang.hmcl.util.OperatingSystem;
|
import org.jackhuang.hmcl.util.OperatingSystem;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -60,7 +61,7 @@ import static org.jackhuang.hmcl.util.StringUtils.removeSuffix;
|
|||||||
|
|
||||||
public final class MainPage extends StackPane implements DecoratorPage {
|
public final class MainPage extends StackPane implements DecoratorPage {
|
||||||
|
|
||||||
private final StringProperty title = new SimpleStringProperty(this, "title", Launcher.i18n("main_page"));
|
private final StringProperty title = new SimpleStringProperty(this, "title", I18n.i18n("main_page"));
|
||||||
|
|
||||||
private Profile profile;
|
private Profile profile;
|
||||||
|
|
||||||
@@ -95,10 +96,10 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
this.profile = event.getProfile();
|
this.profile = event.getProfile();
|
||||||
});
|
});
|
||||||
|
|
||||||
btnAdd.setOnMouseClicked(e -> Controllers.getDecorator().startWizard(new DownloadWizardProvider(), Launcher.i18n("install")));
|
btnAdd.setOnMouseClicked(e -> Controllers.getDecorator().startWizard(new DownloadWizardProvider(), I18n.i18n("install")));
|
||||||
FXUtils.installTooltip(btnAdd, Launcher.i18n("install"));
|
FXUtils.installTooltip(btnAdd, I18n.i18n("install"));
|
||||||
btnRefresh.setOnMouseClicked(e -> Settings.INSTANCE.getSelectedProfile().getRepository().refreshVersionsAsync().start());
|
btnRefresh.setOnMouseClicked(e -> Settings.INSTANCE.getSelectedProfile().getRepository().refreshVersionsAsync().start());
|
||||||
FXUtils.installTooltip(btnRefresh, Launcher.i18n("button.refresh"));
|
FXUtils.installTooltip(btnRefresh, I18n.i18n("button.refresh"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String modifyVersion(String gameVersion, String version) {
|
private String modifyVersion(String gameVersion, String version) {
|
||||||
@@ -117,13 +118,13 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
StringBuilder libraries = new StringBuilder();
|
StringBuilder libraries = new StringBuilder();
|
||||||
for (Library library : version.getLibraries()) {
|
for (Library library : version.getLibraries()) {
|
||||||
if (library.getGroupId().equalsIgnoreCase("net.minecraftforge") && library.getArtifactId().equalsIgnoreCase("forge")) {
|
if (library.getGroupId().equalsIgnoreCase("net.minecraftforge") && library.getArtifactId().equalsIgnoreCase("forge")) {
|
||||||
libraries.append(Launcher.i18n("install.installer.forge")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)forge", ""))).append("\n");
|
libraries.append(I18n.i18n("install.installer.forge")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)forge", ""))).append("\n");
|
||||||
}
|
}
|
||||||
if (library.getGroupId().equalsIgnoreCase("com.mumfrey") && library.getArtifactId().equalsIgnoreCase("liteloader")) {
|
if (library.getGroupId().equalsIgnoreCase("com.mumfrey") && library.getArtifactId().equalsIgnoreCase("liteloader")) {
|
||||||
libraries.append(Launcher.i18n("install.installer.liteloader")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)liteloader", ""))).append("\n");
|
libraries.append(I18n.i18n("install.installer.liteloader")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)liteloader", ""))).append("\n");
|
||||||
}
|
}
|
||||||
if (library.getGroupId().equalsIgnoreCase("net.optifine") && library.getArtifactId().equalsIgnoreCase("optifine")) {
|
if (library.getGroupId().equalsIgnoreCase("net.optifine") && library.getArtifactId().equalsIgnoreCase("optifine")) {
|
||||||
libraries.append(Launcher.i18n("install.installer.optifine")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)optifine", ""))).append("\n");
|
libraries.append(I18n.i18n("install.installer.optifine")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)optifine", ""))).append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,15 +139,15 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
});
|
});
|
||||||
item.setOnScriptButtonClicked(e -> {
|
item.setOnScriptButtonClicked(e -> {
|
||||||
if (Settings.INSTANCE.getSelectedAccount() == null)
|
if (Settings.INSTANCE.getSelectedAccount() == null)
|
||||||
Controllers.dialog(Launcher.i18n("login.empty_username"));
|
Controllers.dialog(I18n.i18n("login.empty_username"));
|
||||||
else {
|
else {
|
||||||
FileChooser chooser = new FileChooser();
|
FileChooser chooser = new FileChooser();
|
||||||
if (repository.getRunDirectory(id).isDirectory())
|
if (repository.getRunDirectory(id).isDirectory())
|
||||||
chooser.setInitialDirectory(repository.getRunDirectory(id));
|
chooser.setInitialDirectory(repository.getRunDirectory(id));
|
||||||
chooser.setTitle(Launcher.i18n("version.launch_script.save"));
|
chooser.setTitle(I18n.i18n("version.launch_script.save"));
|
||||||
chooser.getExtensionFilters().add(OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS
|
chooser.getExtensionFilters().add(OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS
|
||||||
? new FileChooser.ExtensionFilter(Launcher.i18n("extension.bat"), "*.bat")
|
? new FileChooser.ExtensionFilter(I18n.i18n("extension.bat"), "*.bat")
|
||||||
: new FileChooser.ExtensionFilter(Launcher.i18n("extension.sh"), "*.sh"));
|
: new FileChooser.ExtensionFilter(I18n.i18n("extension.sh"), "*.sh"));
|
||||||
File file = chooser.showSaveDialog(Controllers.getStage());
|
File file = chooser.showSaveDialog(Controllers.getStage());
|
||||||
if (file != null)
|
if (file != null)
|
||||||
LauncherHelper.INSTANCE.launch(profile, Settings.INSTANCE.getSelectedAccount(), id, file);
|
LauncherHelper.INSTANCE.launch(profile, Settings.INSTANCE.getSelectedAccount(), id, file);
|
||||||
@@ -158,25 +159,25 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
});
|
});
|
||||||
item.setOnUpdateButtonClicked(event -> {
|
item.setOnUpdateButtonClicked(event -> {
|
||||||
FileChooser chooser = new FileChooser();
|
FileChooser chooser = new FileChooser();
|
||||||
chooser.setTitle(Launcher.i18n("modpack.choose"));
|
chooser.setTitle(I18n.i18n("modpack.choose"));
|
||||||
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(Launcher.i18n("modpack"), "*.zip"));
|
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(I18n.i18n("modpack"), "*.zip"));
|
||||||
File selectedFile = chooser.showOpenDialog(Controllers.getStage());
|
File selectedFile = chooser.showOpenDialog(Controllers.getStage());
|
||||||
if (selectedFile != null) {
|
if (selectedFile != null) {
|
||||||
AtomicReference<Region> region = new AtomicReference<>();
|
AtomicReference<Region> region = new AtomicReference<>();
|
||||||
try {
|
try {
|
||||||
TaskExecutor executor = ModpackHelper.getUpdateTask(profile, selectedFile, id, ModpackHelper.readModpackConfiguration(repository.getModpackConfiguration(id)))
|
TaskExecutor executor = ModpackHelper.getUpdateTask(profile, selectedFile, id, ModpackHelper.readModpackConfiguration(repository.getModpackConfiguration(id)))
|
||||||
.then(Task.of(Schedulers.javafx(), () -> Controllers.closeDialog(region.get()))).executor();
|
.then(Task.of(Schedulers.javafx(), () -> Controllers.closeDialog(region.get()))).executor();
|
||||||
region.set(Controllers.taskDialog(executor, Launcher.i18n("modpack.update"), ""));
|
region.set(Controllers.taskDialog(executor, I18n.i18n("modpack.update"), ""));
|
||||||
executor.start();
|
executor.start();
|
||||||
} catch (UnsupportedModpackException e) {
|
} catch (UnsupportedModpackException e) {
|
||||||
Controllers.closeDialog(region.get());
|
Controllers.closeDialog(region.get());
|
||||||
Controllers.dialog(Launcher.i18n("modpack.unsupported"), Launcher.i18n("message.error"), MessageBox.ERROR_MESSAGE);
|
Controllers.dialog(I18n.i18n("modpack.unsupported"), I18n.i18n("message.error"), MessageBox.ERROR_MESSAGE);
|
||||||
} catch (MismatchedModpackTypeException e) {
|
} catch (MismatchedModpackTypeException e) {
|
||||||
Controllers.closeDialog(region.get());
|
Controllers.closeDialog(region.get());
|
||||||
Controllers.dialog(Launcher.i18n("modpack.mismatched_type"), Launcher.i18n("message.error"), MessageBox.ERROR_MESSAGE);
|
Controllers.dialog(I18n.i18n("modpack.mismatched_type"), I18n.i18n("message.error"), MessageBox.ERROR_MESSAGE);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Controllers.closeDialog(region.get());
|
Controllers.closeDialog(region.get());
|
||||||
Controllers.dialog(Launcher.i18n("modpack.invalid"), Launcher.i18n("message.error"), MessageBox.ERROR_MESSAGE);
|
Controllers.dialog(I18n.i18n("modpack.invalid"), I18n.i18n("message.error"), MessageBox.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -187,10 +188,10 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
versionList.getStyleClass().add("option-list-view");
|
versionList.getStyleClass().add("option-list-view");
|
||||||
FXUtils.setLimitWidth(versionList, 150);
|
FXUtils.setLimitWidth(versionList, 150);
|
||||||
versionList.getItems().setAll(Lang.immutableListOf(
|
versionList.getItems().setAll(Lang.immutableListOf(
|
||||||
Launcher.i18n("version.manage.rename"),
|
I18n.i18n("version.manage.rename"),
|
||||||
Launcher.i18n("version.manage.remove"),
|
I18n.i18n("version.manage.remove"),
|
||||||
Launcher.i18n("modpack.export"),
|
I18n.i18n("modpack.export"),
|
||||||
Launcher.i18n("folder.game")
|
I18n.i18n("folder.game")
|
||||||
));
|
));
|
||||||
versionList.setOnMouseClicked(e -> {
|
versionList.setOnMouseClicked(e -> {
|
||||||
versionPopup.hide();
|
versionPopup.hide();
|
||||||
@@ -214,7 +215,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
versionPopup.show(item, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.LEFT, event.getX(), event.getY());
|
versionPopup.show(item, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.LEFT, event.getX(), event.getY());
|
||||||
} else if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) {
|
} else if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) {
|
||||||
if (Settings.INSTANCE.getSelectedAccount() == null)
|
if (Settings.INSTANCE.getSelectedAccount() == null)
|
||||||
Controllers.dialog(Launcher.i18n("login.empty_username"));
|
Controllers.dialog(I18n.i18n("login.empty_username"));
|
||||||
else
|
else
|
||||||
LauncherHelper.INSTANCE.launch(profile, Settings.INSTANCE.getSelectedAccount(), id, null);
|
LauncherHelper.INSTANCE.launch(profile, Settings.INSTANCE.getSelectedAccount(), id, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,14 @@ import javafx.scene.input.TransferMode;
|
|||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.mod.ModInfo;
|
import org.jackhuang.hmcl.mod.ModInfo;
|
||||||
import org.jackhuang.hmcl.mod.ModManager;
|
import org.jackhuang.hmcl.mod.ModManager;
|
||||||
import org.jackhuang.hmcl.task.Schedulers;
|
import org.jackhuang.hmcl.task.Schedulers;
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.util.FileUtils;
|
import org.jackhuang.hmcl.util.FileUtils;
|
||||||
import org.jackhuang.hmcl.util.Logging;
|
import org.jackhuang.hmcl.util.Logging;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -140,8 +141,8 @@ public final class ModController {
|
|||||||
@FXML
|
@FXML
|
||||||
private void onAdd() {
|
private void onAdd() {
|
||||||
FileChooser chooser = new FileChooser();
|
FileChooser chooser = new FileChooser();
|
||||||
chooser.setTitle(Launcher.i18n("mods.choose_mod"));
|
chooser.setTitle(I18n.i18n("mods.choose_mod"));
|
||||||
chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter(Launcher.i18n("extension.mod"), "*.jar", "*.zip", "*.litemod"));
|
chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter(I18n.i18n("extension.mod"), "*.jar", "*.zip", "*.litemod"));
|
||||||
List<File> res = chooser.showOpenMultipleDialog(Controllers.getStage());
|
List<File> res = chooser.showOpenMultipleDialog(Controllers.getStage());
|
||||||
|
|
||||||
// It's guaranteed that succeeded and failed are thread safe here.
|
// It's guaranteed that succeeded and failed are thread safe here.
|
||||||
@@ -163,10 +164,10 @@ public final class ModController {
|
|||||||
}).with(Task.of(Schedulers.javafx(), variables -> {
|
}).with(Task.of(Schedulers.javafx(), variables -> {
|
||||||
List<String> prompt = new LinkedList<>();
|
List<String> prompt = new LinkedList<>();
|
||||||
if (!succeeded.isEmpty())
|
if (!succeeded.isEmpty())
|
||||||
prompt.add(Launcher.i18n("mods.add.success", String.join(", ", succeeded)));
|
prompt.add(I18n.i18n("mods.add.success", String.join(", ", succeeded)));
|
||||||
if (!failed.isEmpty())
|
if (!failed.isEmpty())
|
||||||
prompt.add(Launcher.i18n("mods.add.failed", String.join(", ", failed)));
|
prompt.add(I18n.i18n("mods.add.failed", String.join(", ", failed)));
|
||||||
Controllers.dialog(String.join("\n", prompt), Launcher.i18n("mods.add"));
|
Controllers.dialog(String.join("\n", prompt), I18n.i18n("mods.add"));
|
||||||
loadMods(modManager, versionId);
|
loadMods(modManager, versionId);
|
||||||
})).start();
|
})).start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,10 @@ import com.jfoenix.controls.JFXCheckBox;
|
|||||||
import com.jfoenix.effects.JFXDepthManager;
|
import com.jfoenix.effects.JFXDepthManager;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.mod.ModInfo;
|
import org.jackhuang.hmcl.mod.ModInfo;
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ public final class ModItem extends BorderPane {
|
|||||||
|
|
||||||
JFXButton btnRemove = new JFXButton();
|
JFXButton btnRemove = new JFXButton();
|
||||||
JFXUtilities.runInFX(() -> {
|
JFXUtilities.runInFX(() -> {
|
||||||
FXUtils.installTooltip(btnRemove, Launcher.i18n("mods.remove"));
|
FXUtils.installTooltip(btnRemove, I18n.i18n("mods.remove"));
|
||||||
});
|
});
|
||||||
btnRemove.setOnMouseClicked(e -> deleteCallback.accept(this));
|
btnRemove.setOnMouseClicked(e -> deleteCallback.accept(this));
|
||||||
btnRemove.getStyleClass().add("toggle-icon4");
|
btnRemove.getStyleClass().add("toggle-icon4");
|
||||||
@@ -53,7 +54,7 @@ public final class ModItem extends BorderPane {
|
|||||||
setStyle("-fx-background-radius: 2; -fx-background-color: white; -fx-padding: 8;");
|
setStyle("-fx-background-radius: 2; -fx-background-color: white; -fx-padding: 8;");
|
||||||
JFXDepthManager.setDepth(this, 1);
|
JFXDepthManager.setDepth(this, 1);
|
||||||
modItem.setTitle(info.getFileName());
|
modItem.setTitle(info.getFileName());
|
||||||
modItem.setSubtitle(info.getName() + ", " + Launcher.i18n("archive.version") + ": " + info.getVersion() + ", " + Launcher.i18n("archive.game_version") + ": " + info.getGameVersion() + ", " + Launcher.i18n("archive.author") + ": " + info.getAuthors());
|
modItem.setSubtitle(info.getName() + ", " + I18n.i18n("archive.version") + ": " + info.getVersion() + ", " + I18n.i18n("archive.game_version") + ": " + info.getGameVersion() + ", " + I18n.i18n("archive.author") + ": " + info.getAuthors());
|
||||||
chkEnabled.setSelected(info.isActive());
|
chkEnabled.setSelected(info.isActive());
|
||||||
chkEnabled.selectedProperty().addListener((a, b, newValue) ->
|
chkEnabled.selectedProperty().addListener((a, b, newValue) ->
|
||||||
info.activeProperty().set(newValue));
|
info.activeProperty().set(newValue));
|
||||||
|
|||||||
@@ -23,13 +23,14 @@ import javafx.beans.property.SimpleStringProperty;
|
|||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.setting.Profile;
|
import org.jackhuang.hmcl.setting.Profile;
|
||||||
import org.jackhuang.hmcl.setting.Profiles;
|
import org.jackhuang.hmcl.setting.Profiles;
|
||||||
import org.jackhuang.hmcl.setting.Settings;
|
import org.jackhuang.hmcl.setting.Settings;
|
||||||
import org.jackhuang.hmcl.ui.construct.FileItem;
|
import org.jackhuang.hmcl.ui.construct.FileItem;
|
||||||
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
||||||
import org.jackhuang.hmcl.util.StringUtils;
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -54,7 +55,7 @@ public final class ProfilePage extends StackPane implements DecoratorPage {
|
|||||||
String profileDisplayName = Optional.ofNullable(profile).map(Profiles::getProfileDisplayName).orElse("");
|
String profileDisplayName = Optional.ofNullable(profile).map(Profiles::getProfileDisplayName).orElse("");
|
||||||
|
|
||||||
title = new SimpleStringProperty(this, "title",
|
title = new SimpleStringProperty(this, "title",
|
||||||
profile == null ? Launcher.i18n("profile.new") : Launcher.i18n("profile") + " - " + profileDisplayName);
|
profile == null ? I18n.i18n("profile.new") : I18n.i18n("profile") + " - " + profileDisplayName);
|
||||||
location = new SimpleStringProperty(this, "location",
|
location = new SimpleStringProperty(this, "location",
|
||||||
Optional.ofNullable(profile).map(Profile::getGameDir).map(File::getAbsolutePath).orElse(""));
|
Optional.ofNullable(profile).map(Profile::getGameDir).map(File::getAbsolutePath).orElse(""));
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ import org.jackhuang.hmcl.ui.construct.MultiFileItem;
|
|||||||
import org.jackhuang.hmcl.ui.construct.Validator;
|
import org.jackhuang.hmcl.ui.construct.Validator;
|
||||||
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.Locales;
|
||||||
|
|
||||||
import java.net.Proxy;
|
import java.net.Proxy;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -49,7 +51,7 @@ import java.util.Collections;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public final class SettingsPage extends StackPane implements DecoratorPage {
|
public final class SettingsPage extends StackPane implements DecoratorPage {
|
||||||
private final StringProperty title = new SimpleStringProperty(this, "title", Launcher.i18n("settings.launcher"));
|
private final StringProperty title = new SimpleStringProperty(this, "title", I18n.i18n("settings.launcher"));
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private JFXTextField txtProxyHost;
|
private JFXTextField txtProxyHost;
|
||||||
@@ -177,12 +179,12 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
|
|
||||||
fileCommonLocation.setProperty(Settings.INSTANCE.commonPathProperty());
|
fileCommonLocation.setProperty(Settings.INSTANCE.commonPathProperty());
|
||||||
|
|
||||||
FXUtils.installTooltip(btnUpdate, Launcher.i18n("update.tooltip"));
|
FXUtils.installTooltip(btnUpdate, I18n.i18n("update.tooltip"));
|
||||||
checkUpdate();
|
checkUpdate();
|
||||||
|
|
||||||
// background
|
// background
|
||||||
backgroundItem.loadChildren(Collections.singletonList(
|
backgroundItem.loadChildren(Collections.singletonList(
|
||||||
backgroundItem.createChildren(Launcher.i18n("launcher.background.default"), EnumBackgroundImage.DEFAULT)
|
backgroundItem.createChildren(I18n.i18n("launcher.background.default"), EnumBackgroundImage.DEFAULT)
|
||||||
));
|
));
|
||||||
|
|
||||||
FXUtils.bindString(backgroundItem.getTxtCustom(), Settings.INSTANCE.backgroundImageProperty());
|
FXUtils.bindString(backgroundItem.getTxtCustom(), Settings.INSTANCE.backgroundImageProperty());
|
||||||
@@ -199,8 +201,8 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
|
|
||||||
// theme
|
// theme
|
||||||
JFXColorPicker picker = new JFXColorPicker(Color.web(Settings.INSTANCE.getTheme().getColor()), null);
|
JFXColorPicker picker = new JFXColorPicker(Color.web(Settings.INSTANCE.getTheme().getColor()), null);
|
||||||
picker.setCustomColorText(Launcher.i18n("color.custom"));
|
picker.setCustomColorText(I18n.i18n("color.custom"));
|
||||||
picker.setRecentColorsText(Launcher.i18n("color.recent"));
|
picker.setRecentColorsText(I18n.i18n("color.recent"));
|
||||||
picker.getCustomColors().setAll(Arrays.stream(Theme.VALUES).map(Theme::getColor).map(Color::web).collect(Collectors.toList()));
|
picker.getCustomColors().setAll(Arrays.stream(Theme.VALUES).map(Theme::getColor).map(Color::web).collect(Collectors.toList()));
|
||||||
picker.setOnAction(e -> {
|
picker.setOnAction(e -> {
|
||||||
Theme theme = Theme.custom(Theme.getColorDisplayName(picker.getValue()));
|
Theme theme = Theme.custom(Theme.getColorDisplayName(picker.getValue()));
|
||||||
@@ -214,7 +216,7 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
private void initBackgroundItemSubtitle() {
|
private void initBackgroundItemSubtitle() {
|
||||||
switch (Settings.INSTANCE.getBackgroundImageType()) {
|
switch (Settings.INSTANCE.getBackgroundImageType()) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
backgroundItem.setSubtitle(Launcher.i18n("launcher.background.default"));
|
backgroundItem.setSubtitle(I18n.i18n("launcher.background.default"));
|
||||||
break;
|
break;
|
||||||
case CUSTOM:
|
case CUSTOM:
|
||||||
backgroundItem.setSubtitle(Settings.INSTANCE.getBackgroundImage());
|
backgroundItem.setSubtitle(Settings.INSTANCE.getBackgroundImage());
|
||||||
@@ -239,16 +241,16 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
btnUpdate.setVisible(Launcher.UPDATE_CHECKER.isOutOfDate());
|
btnUpdate.setVisible(Launcher.UPDATE_CHECKER.isOutOfDate());
|
||||||
|
|
||||||
if (Launcher.UPDATE_CHECKER.isOutOfDate()) {
|
if (Launcher.UPDATE_CHECKER.isOutOfDate()) {
|
||||||
lblUpdateSub.setText(Launcher.i18n("update.newest_version", Launcher.UPDATE_CHECKER.getNewVersion().toString()));
|
lblUpdateSub.setText(I18n.i18n("update.newest_version", Launcher.UPDATE_CHECKER.getNewVersion().toString()));
|
||||||
lblUpdateSub.getStyleClass().setAll("update-label");
|
lblUpdateSub.getStyleClass().setAll("update-label");
|
||||||
|
|
||||||
lblUpdate.setText(Launcher.i18n("update.found"));
|
lblUpdate.setText(I18n.i18n("update.found"));
|
||||||
lblUpdate.getStyleClass().setAll("update-label");
|
lblUpdate.getStyleClass().setAll("update-label");
|
||||||
} else {
|
} else {
|
||||||
lblUpdateSub.setText(Launcher.i18n("update.latest"));
|
lblUpdateSub.setText(I18n.i18n("update.latest"));
|
||||||
lblUpdateSub.getStyleClass().setAll("subtitle-label");
|
lblUpdateSub.getStyleClass().setAll("subtitle-label");
|
||||||
|
|
||||||
lblUpdate.setText(Launcher.i18n("update"));
|
lblUpdate.setText(I18n.i18n("update"));
|
||||||
lblUpdate.getStyleClass().setAll();
|
lblUpdate.getStyleClass().setAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ import javafx.scene.input.MouseEvent;
|
|||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.text.TextAlignment;
|
import javafx.scene.text.TextAlignment;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -175,10 +176,10 @@ public final class VersionItem extends StackPane {
|
|||||||
btnScript.setGraphic(SVG.script(Theme.blackFillBinding(), 15, 15));
|
btnScript.setGraphic(SVG.script(Theme.blackFillBinding(), 15, 15));
|
||||||
|
|
||||||
JFXUtilities.runInFX(() -> {
|
JFXUtilities.runInFX(() -> {
|
||||||
FXUtils.installTooltip(btnSettings, Launcher.i18n("version.settings"));
|
FXUtils.installTooltip(btnSettings, I18n.i18n("version.settings"));
|
||||||
FXUtils.installTooltip(btnUpdate, Launcher.i18n("version.update"));
|
FXUtils.installTooltip(btnUpdate, I18n.i18n("version.update"));
|
||||||
FXUtils.installTooltip(btnLaunch, Launcher.i18n("version.launch"));
|
FXUtils.installTooltip(btnLaunch, I18n.i18n("version.launch"));
|
||||||
FXUtils.installTooltip(btnScript, Launcher.i18n("version.launch_script"));
|
FXUtils.installTooltip(btnScript, I18n.i18n("version.launch_script"));
|
||||||
});
|
});
|
||||||
|
|
||||||
icon.translateYProperty().bind(Bindings.createDoubleBinding(() -> header.getBoundsInParent().getHeight() - icon.getHeight() / 2 - 16, header.boundsInParentProperty(), icon.heightProperty()));
|
icon.translateYProperty().bind(Bindings.createDoubleBinding(() -> header.getBoundsInParent().getHeight() - icon.getHeight() / 2 - 16, header.boundsInParentProperty(), icon.heightProperty()));
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ import javafx.beans.property.StringProperty;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.download.game.GameAssetIndexDownloadTask;
|
import org.jackhuang.hmcl.download.game.GameAssetIndexDownloadTask;
|
||||||
import org.jackhuang.hmcl.setting.Profile;
|
import org.jackhuang.hmcl.setting.Profile;
|
||||||
import org.jackhuang.hmcl.ui.export.ExportWizardProvider;
|
import org.jackhuang.hmcl.ui.export.ExportWizardProvider;
|
||||||
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
||||||
import org.jackhuang.hmcl.util.FileUtils;
|
import org.jackhuang.hmcl.util.FileUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -79,17 +80,17 @@ public final class VersionPage extends StackPane implements DecoratorPage {
|
|||||||
browsePopup = new JFXPopup(browseList);
|
browsePopup = new JFXPopup(browseList);
|
||||||
managementPopup = new JFXPopup(managementList);
|
managementPopup = new JFXPopup(managementList);
|
||||||
|
|
||||||
FXUtils.installTooltip(btnDelete, Launcher.i18n("version.manage.remove"));
|
FXUtils.installTooltip(btnDelete, I18n.i18n("version.manage.remove"));
|
||||||
FXUtils.installTooltip(btnBrowseMenu, Launcher.i18n("settings.game.exploration"));
|
FXUtils.installTooltip(btnBrowseMenu, I18n.i18n("settings.game.exploration"));
|
||||||
FXUtils.installTooltip(btnManagementMenu, Launcher.i18n("settings.game.management"));
|
FXUtils.installTooltip(btnManagementMenu, I18n.i18n("settings.game.management"));
|
||||||
FXUtils.installTooltip(btnExport, Launcher.i18n("modpack.export"));
|
FXUtils.installTooltip(btnExport, I18n.i18n("modpack.export"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(String id, Profile profile) {
|
public void load(String id, Profile profile) {
|
||||||
this.version = id;
|
this.version = id;
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
|
|
||||||
title.set(Launcher.i18n("settings.game") + " - " + id);
|
title.set(I18n.i18n("settings.game") + " - " + id);
|
||||||
|
|
||||||
versionSettingsController.loadVersionSetting(profile, id);
|
versionSettingsController.loadVersionSetting(profile, id);
|
||||||
modController.setParentTab(tabPane);
|
modController.setParentTab(tabPane);
|
||||||
@@ -185,7 +186,7 @@ public final class VersionPage extends StackPane implements DecoratorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteVersion(Profile profile, String version) {
|
public static void deleteVersion(Profile profile, String version) {
|
||||||
Controllers.confirmDialog(Launcher.i18n("version.manage.remove.confirm", version), Launcher.i18n("message.confirm"), () -> {
|
Controllers.confirmDialog(I18n.i18n("version.manage.remove.confirm", version), I18n.i18n("message.confirm"), () -> {
|
||||||
if (profile.getRepository().removeVersionFromDisk(version)) {
|
if (profile.getRepository().removeVersionFromDisk(version)) {
|
||||||
profile.getRepository().refreshVersionsAsync().start();
|
profile.getRepository().refreshVersionsAsync().start();
|
||||||
Controllers.navigate(null);
|
Controllers.navigate(null);
|
||||||
@@ -194,7 +195,7 @@ public final class VersionPage extends StackPane implements DecoratorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void renameVersion(Profile profile, String version) {
|
public static void renameVersion(Profile profile, String version) {
|
||||||
Controllers.inputDialog(Launcher.i18n("version.manage.rename.message"), res -> {
|
Controllers.inputDialog(I18n.i18n("version.manage.rename.message"), res -> {
|
||||||
if (profile.getRepository().renameVersion(version, res)) {
|
if (profile.getRepository().renameVersion(version, res)) {
|
||||||
profile.getRepository().refreshVersionsAsync().start();
|
profile.getRepository().refreshVersionsAsync().start();
|
||||||
Controllers.navigate(null);
|
Controllers.navigate(null);
|
||||||
@@ -203,6 +204,6 @@ public final class VersionPage extends StackPane implements DecoratorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void exportVersion(Profile profile, String version) {
|
public static void exportVersion(Profile profile, String version) {
|
||||||
Controllers.getDecorator().startWizard(new ExportWizardProvider(profile, version), Launcher.i18n("modpack.wizard"));
|
Controllers.getDecorator().startWizard(new ExportWizardProvider(profile, version), I18n.i18n("modpack.wizard"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import javafx.scene.control.Toggle;
|
|||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.setting.EnumGameDirectory;
|
import org.jackhuang.hmcl.setting.EnumGameDirectory;
|
||||||
import org.jackhuang.hmcl.setting.Profile;
|
import org.jackhuang.hmcl.setting.Profile;
|
||||||
import org.jackhuang.hmcl.setting.VersionSetting;
|
import org.jackhuang.hmcl.setting.VersionSetting;
|
||||||
@@ -39,6 +39,7 @@ import org.jackhuang.hmcl.ui.construct.ComponentList;
|
|||||||
import org.jackhuang.hmcl.ui.construct.ImagePickerItem;
|
import org.jackhuang.hmcl.ui.construct.ImagePickerItem;
|
||||||
import org.jackhuang.hmcl.ui.construct.MultiFileItem;
|
import org.jackhuang.hmcl.ui.construct.MultiFileItem;
|
||||||
import org.jackhuang.hmcl.util.*;
|
import org.jackhuang.hmcl.util.*;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -79,7 +80,7 @@ public final class VersionSettingsController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
lblPhysicalMemory.setText(Launcher.i18n("settings.physical_memory") + ": " + OperatingSystem.TOTAL_MEMORY + "MB");
|
lblPhysicalMemory.setText(I18n.i18n("settings.physical_memory") + ": " + OperatingSystem.TOTAL_MEMORY + "MB");
|
||||||
|
|
||||||
FXUtils.smoothScrolling(scroll);
|
FXUtils.smoothScrolling(scroll);
|
||||||
|
|
||||||
@@ -96,13 +97,13 @@ public final class VersionSettingsController {
|
|||||||
javaItem.getExtensionFilters().add(new FileChooser.ExtensionFilter("Java", "java.exe", "javaw.exe"));
|
javaItem.getExtensionFilters().add(new FileChooser.ExtensionFilter("Java", "java.exe", "javaw.exe"));
|
||||||
|
|
||||||
gameDirItem.loadChildren(Arrays.asList(
|
gameDirItem.loadChildren(Arrays.asList(
|
||||||
gameDirItem.createChildren(Launcher.i18n("settings.advanced.game_dir.default"), EnumGameDirectory.ROOT_FOLDER),
|
gameDirItem.createChildren(I18n.i18n("settings.advanced.game_dir.default"), EnumGameDirectory.ROOT_FOLDER),
|
||||||
gameDirItem.createChildren(Launcher.i18n("settings.advanced.game_dir.independent"), EnumGameDirectory.VERSION_FOLDER)
|
gameDirItem.createChildren(I18n.i18n("settings.advanced.game_dir.independent"), EnumGameDirectory.VERSION_FOLDER)
|
||||||
));
|
));
|
||||||
|
|
||||||
globalItem.loadChildren(Arrays.asList(
|
globalItem.loadChildren(Arrays.asList(
|
||||||
globalItem.createChildren(Launcher.i18n("settings.type.global"), true),
|
globalItem.createChildren(I18n.i18n("settings.type.global"), true),
|
||||||
globalItem.createChildren(Launcher.i18n("settings.type.special"), false)
|
globalItem.createChildren(I18n.i18n("settings.type.special"), false)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +183,7 @@ public final class VersionSettingsController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
versionSetting.usesGlobalProperty().setChangedListenerAndOperate(it ->
|
versionSetting.usesGlobalProperty().setChangedListenerAndOperate(it ->
|
||||||
globalItem.setSubtitle(Launcher.i18n(versionSetting.isUsesGlobal() ? "settings.type.global" : "settings.type.special")));
|
globalItem.setSubtitle(I18n.i18n(versionSetting.isUsesGlobal() ? "settings.type.global" : "settings.type.special")));
|
||||||
|
|
||||||
gameDirItem.getGroup().getToggles().stream()
|
gameDirItem.getGroup().getToggles().stream()
|
||||||
.filter(it -> it.getUserData() == versionSetting.getGameDirType())
|
.filter(it -> it.getUserData() == versionSetting.getGameDirType())
|
||||||
@@ -238,7 +239,7 @@ public final class VersionSettingsController {
|
|||||||
@FXML
|
@FXML
|
||||||
private void onExploreIcon() {
|
private void onExploreIcon() {
|
||||||
FileChooser chooser = new FileChooser();
|
FileChooser chooser = new FileChooser();
|
||||||
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(Launcher.i18n("extension.png"), "*.png"));
|
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(I18n.i18n("extension.png"), "*.png"));
|
||||||
File selectedFile = chooser.showOpenDialog(Controllers.getStage());
|
File selectedFile = chooser.showOpenDialog(Controllers.getStage());
|
||||||
if (selectedFile != null) {
|
if (selectedFile != null) {
|
||||||
File iconFile = profile.getRepository().getVersionIcon(versionId);
|
File iconFile = profile.getRepository().getVersionIcon(versionId);
|
||||||
|
|||||||
@@ -26,11 +26,12 @@ import javafx.scene.control.Tooltip;
|
|||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
import org.jackhuang.hmcl.ui.Controllers;
|
import org.jackhuang.hmcl.ui.Controllers;
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
import org.jackhuang.hmcl.ui.SVG;
|
import org.jackhuang.hmcl.ui.SVG;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ public class FileItem extends BorderPane {
|
|||||||
right.setGraphic(SVG.pencil(Theme.blackFillBinding(), 15, 15));
|
right.setGraphic(SVG.pencil(Theme.blackFillBinding(), 15, 15));
|
||||||
right.getStyleClass().add("toggle-icon4");
|
right.getStyleClass().add("toggle-icon4");
|
||||||
right.setOnMouseClicked(e -> onExplore());
|
right.setOnMouseClicked(e -> onExplore());
|
||||||
FXUtils.installTooltip(right, Launcher.i18n("button.edit"));
|
FXUtils.installTooltip(right, I18n.i18n("button.edit"));
|
||||||
setRight(right);
|
setRight(right);
|
||||||
|
|
||||||
Tooltip tip = new Tooltip();
|
Tooltip tip = new Tooltip();
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ import javafx.scene.input.MouseEvent;
|
|||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
import org.jackhuang.hmcl.ui.SVG;
|
import org.jackhuang.hmcl.ui.SVG;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
@DefaultProperty("image")
|
@DefaultProperty("image")
|
||||||
public final class ImagePickerItem extends BorderPane {
|
public final class ImagePickerItem extends BorderPane {
|
||||||
@@ -41,7 +42,7 @@ public final class ImagePickerItem extends BorderPane {
|
|||||||
selectButton.onMouseClickedProperty().bind(onSelectButtonClicked);
|
selectButton.onMouseClickedProperty().bind(onSelectButtonClicked);
|
||||||
selectButton.getStyleClass().add("toggle-icon4");
|
selectButton.getStyleClass().add("toggle-icon4");
|
||||||
|
|
||||||
FXUtils.installTooltip(selectButton, Launcher.i18n("button.edit"));
|
FXUtils.installTooltip(selectButton, I18n.i18n("button.edit"));
|
||||||
|
|
||||||
HBox hBox = new HBox();
|
HBox hBox = new HBox();
|
||||||
hBox.getChildren().setAll(imageView, selectButton);
|
hBox.getChildren().setAll(imageView, selectButton);
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ package org.jackhuang.hmcl.ui.construct;
|
|||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
import javafx.scene.control.TextInputDialog;
|
import javafx.scene.control.TextInputDialog;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -30,7 +31,7 @@ public final class MessageBox {
|
|||||||
private MessageBox() {
|
private MessageBox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String TITLE = Launcher.i18n("message.info");
|
private static final String TITLE = I18n.i18n("message.info");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User Operation: Yes
|
* User Operation: Yes
|
||||||
|
|||||||
@@ -23,10 +23,11 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
import org.jackhuang.hmcl.ui.SVG;
|
import org.jackhuang.hmcl.ui.SVG;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -91,8 +92,8 @@ public final class MessageDialogPane extends StackPane {
|
|||||||
Optional.ofNullable(onCancel).ifPresent(Runnable::run);
|
Optional.ofNullable(onCancel).ifPresent(Runnable::run);
|
||||||
});
|
});
|
||||||
|
|
||||||
acceptButton.setText(Launcher.i18n("button.yes"));
|
acceptButton.setText(I18n.i18n("button.yes"));
|
||||||
cancelButton.setText(Launcher.i18n("button.no"));
|
cancelButton.setText(I18n.i18n("button.no"));
|
||||||
|
|
||||||
actions.getChildren().add(cancelButton);
|
actions.getChildren().add(cancelButton);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,16 +13,17 @@ import javafx.scene.layout.BorderPane;
|
|||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class MultiColorItem extends ComponentList {
|
public class MultiColorItem extends ComponentList {
|
||||||
private final StringProperty customTitle = new SimpleStringProperty(this, "customTitle", Launcher.i18n("selector.custom"));
|
private final StringProperty customTitle = new SimpleStringProperty(this, "customTitle", I18n.i18n("selector.custom"));
|
||||||
private final StringProperty chooserTitle = new SimpleStringProperty(this, "chooserTitle", Launcher.i18n("selector.choose_file"));
|
private final StringProperty chooserTitle = new SimpleStringProperty(this, "chooserTitle", I18n.i18n("selector.choose_file"));
|
||||||
|
|
||||||
private final ToggleGroup group = new ToggleGroup();
|
private final ToggleGroup group = new ToggleGroup();
|
||||||
private final JFXColorPicker colorPicker = new JFXColorPicker();
|
private final JFXColorPicker colorPicker = new JFXColorPicker();
|
||||||
|
|||||||
@@ -37,19 +37,20 @@ import javafx.scene.layout.HBox;
|
|||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
import org.jackhuang.hmcl.ui.Controllers;
|
import org.jackhuang.hmcl.ui.Controllers;
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
import org.jackhuang.hmcl.ui.SVG;
|
import org.jackhuang.hmcl.ui.SVG;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class MultiFileItem extends ComponentList {
|
public class MultiFileItem extends ComponentList {
|
||||||
private final StringProperty customTitle = new SimpleStringProperty(this, "customTitle", Launcher.i18n("selector.custom"));
|
private final StringProperty customTitle = new SimpleStringProperty(this, "customTitle", I18n.i18n("selector.custom"));
|
||||||
private final StringProperty chooserTitle = new SimpleStringProperty(this, "chooserTitle", Launcher.i18n("selector.choose_file"));
|
private final StringProperty chooserTitle = new SimpleStringProperty(this, "chooserTitle", I18n.i18n("selector.choose_file"));
|
||||||
private final BooleanProperty directory = new SimpleBooleanProperty(this, "directory", false);
|
private final BooleanProperty directory = new SimpleBooleanProperty(this, "directory", false);
|
||||||
private final ObservableList<FileChooser.ExtensionFilter> extensionFilters = FXCollections.observableArrayList();
|
private final ObservableList<FileChooser.ExtensionFilter> extensionFilters = FXCollections.observableArrayList();
|
||||||
|
|
||||||
@@ -147,7 +148,7 @@ public class MultiFileItem extends ComponentList {
|
|||||||
|
|
||||||
public void onExploreJavaDir() {
|
public void onExploreJavaDir() {
|
||||||
DirectoryChooser chooser = new DirectoryChooser();
|
DirectoryChooser chooser = new DirectoryChooser();
|
||||||
chooser.setTitle(Launcher.i18n(getChooserTitle()));
|
chooser.setTitle(I18n.i18n(getChooserTitle()));
|
||||||
File selectedDir = chooser.showDialog(Controllers.getStage());
|
File selectedDir = chooser.showDialog(Controllers.getStage());
|
||||||
if (selectedDir != null)
|
if (selectedDir != null)
|
||||||
txtCustom.setText(selectedDir.getAbsolutePath());
|
txtCustom.setText(selectedDir.getAbsolutePath());
|
||||||
|
|||||||
@@ -19,13 +19,14 @@ package org.jackhuang.hmcl.ui.construct;
|
|||||||
|
|
||||||
import com.jfoenix.concurrency.JFXUtilities;
|
import com.jfoenix.concurrency.JFXUtilities;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.task.TaskExecutor;
|
import org.jackhuang.hmcl.task.TaskExecutor;
|
||||||
import org.jackhuang.hmcl.task.TaskListener;
|
import org.jackhuang.hmcl.task.TaskListener;
|
||||||
import org.jackhuang.hmcl.ui.Controllers;
|
import org.jackhuang.hmcl.ui.Controllers;
|
||||||
import org.jackhuang.hmcl.ui.wizard.AbstractWizardDisplayer;
|
import org.jackhuang.hmcl.ui.wizard.AbstractWizardDisplayer;
|
||||||
import org.jackhuang.hmcl.util.StringUtils;
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ public interface TaskExecutorDialogWizardDisplayer extends AbstractWizardDisplay
|
|||||||
Controllers.navigate(null);
|
Controllers.navigate(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
pane.setTitle(Launcher.i18n("message.doing"));
|
pane.setTitle(I18n.i18n("message.doing"));
|
||||||
pane.setProgress(Double.MAX_VALUE);
|
pane.setProgress(Double.MAX_VALUE);
|
||||||
if (settings.containsKey("title")) {
|
if (settings.containsKey("title")) {
|
||||||
Object title = settings.get("title");
|
Object title = settings.get("title");
|
||||||
@@ -66,7 +67,7 @@ public interface TaskExecutorDialogWizardDisplayer extends AbstractWizardDisplay
|
|||||||
if (settings.containsKey("success_message") && settings.get("success_message") instanceof String)
|
if (settings.containsKey("success_message") && settings.get("success_message") instanceof String)
|
||||||
Controllers.dialog((String) settings.get("success_message"), null, MessageBox.FINE_MESSAGE, () -> Controllers.navigate(null));
|
Controllers.dialog((String) settings.get("success_message"), null, MessageBox.FINE_MESSAGE, () -> Controllers.navigate(null));
|
||||||
else if (!settings.containsKey("forbid_success_message"))
|
else if (!settings.containsKey("forbid_success_message"))
|
||||||
Controllers.dialog(Launcher.i18n("message.success"), null, MessageBox.FINE_MESSAGE, () -> Controllers.navigate(null));
|
Controllers.dialog(I18n.i18n("message.success"), null, MessageBox.FINE_MESSAGE, () -> Controllers.navigate(null));
|
||||||
} else {
|
} else {
|
||||||
if (executor.getLastException() == null)
|
if (executor.getLastException() == null)
|
||||||
return;
|
return;
|
||||||
@@ -74,7 +75,7 @@ public interface TaskExecutorDialogWizardDisplayer extends AbstractWizardDisplay
|
|||||||
if (settings.containsKey("failure_message") && settings.get("failure_message") instanceof String)
|
if (settings.containsKey("failure_message") && settings.get("failure_message") instanceof String)
|
||||||
Controllers.dialog(appendix, (String) settings.get("failure_message"), MessageBox.ERROR_MESSAGE, () -> Controllers.navigate(null));
|
Controllers.dialog(appendix, (String) settings.get("failure_message"), MessageBox.ERROR_MESSAGE, () -> Controllers.navigate(null));
|
||||||
else if (!settings.containsKey("forbid_failure_message"))
|
else if (!settings.containsKey("forbid_failure_message"))
|
||||||
Controllers.dialog(appendix, Launcher.i18n("wizard.failed"), MessageBox.ERROR_MESSAGE, () -> Controllers.navigate(null));
|
Controllers.dialog(appendix, I18n.i18n("wizard.failed"), MessageBox.ERROR_MESSAGE, () -> Controllers.navigate(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.download.forge.ForgeInstallTask;
|
import org.jackhuang.hmcl.download.forge.ForgeInstallTask;
|
||||||
import org.jackhuang.hmcl.download.game.GameAssetDownloadTask;
|
import org.jackhuang.hmcl.download.game.GameAssetDownloadTask;
|
||||||
import org.jackhuang.hmcl.download.game.GameAssetRefreshTask;
|
import org.jackhuang.hmcl.download.game.GameAssetRefreshTask;
|
||||||
@@ -35,6 +35,7 @@ import org.jackhuang.hmcl.mod.*;
|
|||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.task.TaskExecutor;
|
import org.jackhuang.hmcl.task.TaskExecutor;
|
||||||
import org.jackhuang.hmcl.task.TaskListener;
|
import org.jackhuang.hmcl.task.TaskListener;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -62,29 +63,29 @@ public final class TaskListPane extends StackPane {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (task instanceof GameAssetRefreshTask) {
|
if (task instanceof GameAssetRefreshTask) {
|
||||||
task.setName(Launcher.i18n("assets.download"));
|
task.setName(I18n.i18n("assets.download"));
|
||||||
} else if (task instanceof GameAssetDownloadTask) {
|
} else if (task instanceof GameAssetDownloadTask) {
|
||||||
task.setName(Launcher.i18n("assets.download_all"));
|
task.setName(I18n.i18n("assets.download_all"));
|
||||||
} else if (task instanceof ForgeInstallTask) {
|
} else if (task instanceof ForgeInstallTask) {
|
||||||
task.setName(Launcher.i18n("install.installer.install", Launcher.i18n("install.installer.forge")));
|
task.setName(I18n.i18n("install.installer.install", I18n.i18n("install.installer.forge")));
|
||||||
} else if (task instanceof LiteLoaderInstallTask) {
|
} else if (task instanceof LiteLoaderInstallTask) {
|
||||||
task.setName(Launcher.i18n("install.installer.install", Launcher.i18n("install.installer.liteloader")));
|
task.setName(I18n.i18n("install.installer.install", I18n.i18n("install.installer.liteloader")));
|
||||||
} else if (task instanceof OptiFineInstallTask) {
|
} else if (task instanceof OptiFineInstallTask) {
|
||||||
task.setName(Launcher.i18n("install.installer.install", Launcher.i18n("install.installer.optifine")));
|
task.setName(I18n.i18n("install.installer.install", I18n.i18n("install.installer.optifine")));
|
||||||
} else if (task instanceof CurseCompletionTask) {
|
} else if (task instanceof CurseCompletionTask) {
|
||||||
task.setName(Launcher.i18n("modpack.type.curse.completion"));
|
task.setName(I18n.i18n("modpack.type.curse.completion"));
|
||||||
} else if (task instanceof ModpackInstallTask) {
|
} else if (task instanceof ModpackInstallTask) {
|
||||||
task.setName(Launcher.i18n("modpack.installing"));
|
task.setName(I18n.i18n("modpack.installing"));
|
||||||
} else if (task instanceof CurseInstallTask) {
|
} else if (task instanceof CurseInstallTask) {
|
||||||
task.setName(Launcher.i18n("modpack.install", Launcher.i18n("modpack.type.curse")));
|
task.setName(I18n.i18n("modpack.install", I18n.i18n("modpack.type.curse")));
|
||||||
} else if (task instanceof MultiMCModpackInstallTask) {
|
} else if (task instanceof MultiMCModpackInstallTask) {
|
||||||
task.setName(Launcher.i18n("modpack.install", Launcher.i18n("modpack.type.multimc")));
|
task.setName(I18n.i18n("modpack.install", I18n.i18n("modpack.type.multimc")));
|
||||||
} else if (task instanceof HMCLModpackInstallTask) {
|
} else if (task instanceof HMCLModpackInstallTask) {
|
||||||
task.setName(Launcher.i18n("modpack.install", Launcher.i18n("modpack.type.hmcl")));
|
task.setName(I18n.i18n("modpack.install", I18n.i18n("modpack.type.hmcl")));
|
||||||
} else if (task instanceof HMCLModpackExportTask) {
|
} else if (task instanceof HMCLModpackExportTask) {
|
||||||
task.setName(Launcher.i18n("modpack.export"));
|
task.setName(I18n.i18n("modpack.export"));
|
||||||
} else if (task instanceof MinecraftInstanceTask) {
|
} else if (task instanceof MinecraftInstanceTask) {
|
||||||
task.setName(Launcher.i18n("modpack.scan"));
|
task.setName(I18n.i18n("modpack.scan"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressListNode node = new ProgressListNode(task);
|
ProgressListNode node = new ProgressListNode(task);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import javafx.fxml.FXML;
|
|||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.download.DownloadProvider;
|
import org.jackhuang.hmcl.download.DownloadProvider;
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
import org.jackhuang.hmcl.game.GameRepository;
|
import org.jackhuang.hmcl.game.GameRepository;
|
||||||
@@ -30,12 +30,11 @@ import org.jackhuang.hmcl.ui.FXUtils;
|
|||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.Launcher.i18n;
|
|
||||||
|
|
||||||
class AdditionalInstallersPage extends StackPane implements WizardPage {
|
class AdditionalInstallersPage extends StackPane implements WizardPage {
|
||||||
private final InstallerWizardProvider provider;
|
private final InstallerWizardProvider provider;
|
||||||
private final WizardController controller;
|
private final WizardController controller;
|
||||||
@@ -72,21 +71,21 @@ class AdditionalInstallersPage extends StackPane implements WizardPage {
|
|||||||
|
|
||||||
btnForge.setOnMouseClicked(e -> {
|
btnForge.setOnMouseClicked(e -> {
|
||||||
controller.getSettings().put(INSTALLER_TYPE, 0);
|
controller.getSettings().put(INSTALLER_TYPE, 0);
|
||||||
controller.onNext(new VersionsPage(controller, i18n("install.installer.choose", i18n("install.installer.forge")), provider.getGameVersion(), downloadProvider, "forge", () -> {
|
controller.onNext(new VersionsPage(controller, I18n.i18n("install.installer.choose", I18n.i18n("install.installer.forge")), provider.getGameVersion(), downloadProvider, "forge", () -> {
|
||||||
controller.onPrev(false);
|
controller.onPrev(false);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
btnLiteLoader.setOnMouseClicked(e -> {
|
btnLiteLoader.setOnMouseClicked(e -> {
|
||||||
controller.getSettings().put(INSTALLER_TYPE, 1);
|
controller.getSettings().put(INSTALLER_TYPE, 1);
|
||||||
controller.onNext(new VersionsPage(controller, i18n("install.installer.choose", i18n("install.installer.liteloader")), provider.getGameVersion(), downloadProvider, "liteloader", () -> {
|
controller.onNext(new VersionsPage(controller, I18n.i18n("install.installer.choose", I18n.i18n("install.installer.liteloader")), provider.getGameVersion(), downloadProvider, "liteloader", () -> {
|
||||||
controller.onPrev(false);
|
controller.onPrev(false);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
btnOptiFine.setOnMouseClicked(e -> {
|
btnOptiFine.setOnMouseClicked(e -> {
|
||||||
controller.getSettings().put(INSTALLER_TYPE, 2);
|
controller.getSettings().put(INSTALLER_TYPE, 2);
|
||||||
controller.onNext(new VersionsPage(controller, i18n("install.installer.choose", i18n("install.installer.optifine")), provider.getGameVersion(), downloadProvider, "optifine", () -> {
|
controller.onNext(new VersionsPage(controller, I18n.i18n("install.installer.choose", I18n.i18n("install.installer.optifine")), provider.getGameVersion(), downloadProvider, "optifine", () -> {
|
||||||
controller.onPrev(false);
|
controller.onPrev(false);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@@ -100,7 +99,7 @@ class AdditionalInstallersPage extends StackPane implements WizardPage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return Launcher.i18n("settings.tabs.installers");
|
return I18n.i18n("settings.tabs.installers");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getVersion(String id) {
|
private String getVersion(String id) {
|
||||||
@@ -109,24 +108,24 @@ class AdditionalInstallersPage extends StackPane implements WizardPage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNavigate(Map<String, Object> settings) {
|
public void onNavigate(Map<String, Object> settings) {
|
||||||
lblGameVersion.setText(Launcher.i18n("install.new_game.current_game_version") + ": " + provider.getGameVersion());
|
lblGameVersion.setText(I18n.i18n("install.new_game.current_game_version") + ": " + provider.getGameVersion());
|
||||||
btnForge.setDisable(provider.getForge() != null);
|
btnForge.setDisable(provider.getForge() != null);
|
||||||
if (provider.getForge() != null || controller.getSettings().containsKey("forge"))
|
if (provider.getForge() != null || controller.getSettings().containsKey("forge"))
|
||||||
lblForge.setText(Launcher.i18n("install.installer.version", Launcher.i18n("install.installer.forge")) + ": " + Lang.nonNull(provider.getForge(), getVersion("forge")));
|
lblForge.setText(I18n.i18n("install.installer.version", I18n.i18n("install.installer.forge")) + ": " + Lang.nonNull(provider.getForge(), getVersion("forge")));
|
||||||
else
|
else
|
||||||
lblForge.setText(Launcher.i18n("install.installer.not_installed", Launcher.i18n("install.installer.forge")));
|
lblForge.setText(I18n.i18n("install.installer.not_installed", I18n.i18n("install.installer.forge")));
|
||||||
|
|
||||||
btnLiteLoader.setDisable(provider.getLiteLoader() != null);
|
btnLiteLoader.setDisable(provider.getLiteLoader() != null);
|
||||||
if (provider.getLiteLoader() != null || controller.getSettings().containsKey("liteloader"))
|
if (provider.getLiteLoader() != null || controller.getSettings().containsKey("liteloader"))
|
||||||
lblLiteLoader.setText(Launcher.i18n("install.installer.version", Launcher.i18n("install.installer.liteloader")) + ": " + Lang.nonNull(provider.getLiteLoader(), getVersion("liteloader")));
|
lblLiteLoader.setText(I18n.i18n("install.installer.version", I18n.i18n("install.installer.liteloader")) + ": " + Lang.nonNull(provider.getLiteLoader(), getVersion("liteloader")));
|
||||||
else
|
else
|
||||||
lblLiteLoader.setText(Launcher.i18n("install.installer.not_installed", Launcher.i18n("install.installer.liteloader")));
|
lblLiteLoader.setText(I18n.i18n("install.installer.not_installed", I18n.i18n("install.installer.liteloader")));
|
||||||
|
|
||||||
btnOptiFine.setDisable(provider.getOptiFine() != null);
|
btnOptiFine.setDisable(provider.getOptiFine() != null);
|
||||||
if (provider.getOptiFine() != null || controller.getSettings().containsKey("optifine"))
|
if (provider.getOptiFine() != null || controller.getSettings().containsKey("optifine"))
|
||||||
lblOptiFine.setText(Launcher.i18n("install.installer.version", Launcher.i18n("install.installer.optifine")) + ": " + Lang.nonNull(provider.getOptiFine(), getVersion("optifine")));
|
lblOptiFine.setText(I18n.i18n("install.installer.version", I18n.i18n("install.installer.optifine")) + ": " + Lang.nonNull(provider.getOptiFine(), getVersion("optifine")));
|
||||||
else
|
else
|
||||||
lblOptiFine.setText(Launcher.i18n("install.installer.not_installed", Launcher.i18n("install.installer.optifine")));
|
lblOptiFine.setText(I18n.i18n("install.installer.not_installed", I18n.i18n("install.installer.optifine")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
package org.jackhuang.hmcl.ui.download;
|
package org.jackhuang.hmcl.ui.download;
|
||||||
|
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.download.DownloadProvider;
|
import org.jackhuang.hmcl.download.DownloadProvider;
|
||||||
import org.jackhuang.hmcl.download.GameBuilder;
|
import org.jackhuang.hmcl.download.GameBuilder;
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
@@ -30,11 +30,11 @@ import org.jackhuang.hmcl.task.Task;
|
|||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardProvider;
|
import org.jackhuang.hmcl.ui.wizard.WizardProvider;
|
||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.Launcher.i18n;
|
|
||||||
import static org.jackhuang.hmcl.util.Lang.tryCast;
|
import static org.jackhuang.hmcl.util.Lang.tryCast;
|
||||||
|
|
||||||
public final class DownloadWizardProvider implements WizardProvider {
|
public final class DownloadWizardProvider implements WizardProvider {
|
||||||
@@ -78,8 +78,8 @@ public final class DownloadWizardProvider implements WizardProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object finish(Map<String, Object> settings) {
|
public Object finish(Map<String, Object> settings) {
|
||||||
settings.put("success_message", Launcher.i18n("install.success"));
|
settings.put("success_message", I18n.i18n("install.success"));
|
||||||
settings.put("failure_message", Launcher.i18n("install.failed"));
|
settings.put("failure_message", I18n.i18n("install.failed"));
|
||||||
|
|
||||||
switch (Lang.parseInt(settings.get(InstallTypePage.INSTALL_TYPE), -1)) {
|
switch (Lang.parseInt(settings.get(InstallTypePage.INSTALL_TYPE), -1)) {
|
||||||
case 0: return finishVersionDownloadingAsync(settings);
|
case 0: return finishVersionDownloadingAsync(settings);
|
||||||
@@ -98,7 +98,7 @@ public final class DownloadWizardProvider implements WizardProvider {
|
|||||||
int subStep = Lang.parseInt(settings.get(InstallTypePage.INSTALL_TYPE), -1);
|
int subStep = Lang.parseInt(settings.get(InstallTypePage.INSTALL_TYPE), -1);
|
||||||
switch (subStep) {
|
switch (subStep) {
|
||||||
case 0:
|
case 0:
|
||||||
return new VersionsPage(controller, i18n("install.installer.choose", i18n("install.installer.game")), "", provider, "game", () -> controller.onNext(new InstallersPage(controller, profile.getRepository(), provider)));
|
return new VersionsPage(controller, I18n.i18n("install.installer.choose", I18n.i18n("install.installer.game")), "", provider, "game", () -> controller.onNext(new InstallersPage(controller, profile.getRepository(), provider)));
|
||||||
case 1:
|
case 1:
|
||||||
return new ModpackPage(controller);
|
return new ModpackPage(controller);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -20,10 +20,11 @@ package org.jackhuang.hmcl.ui.download;
|
|||||||
import com.jfoenix.controls.JFXListView;
|
import com.jfoenix.controls.JFXListView;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ public final class InstallTypePage extends StackPane implements WizardPage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return Launcher.i18n("install.select");
|
return I18n.i18n("install.select");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String INSTALL_TYPE = "INSTALL_TYPE";
|
public static final String INSTALL_TYPE = "INSTALL_TYPE";
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
package org.jackhuang.hmcl.ui.download;
|
package org.jackhuang.hmcl.ui.download;
|
||||||
|
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.download.BMCLAPIDownloadProvider;
|
import org.jackhuang.hmcl.download.BMCLAPIDownloadProvider;
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
import org.jackhuang.hmcl.game.Version;
|
import org.jackhuang.hmcl.game.Version;
|
||||||
@@ -26,6 +26,7 @@ import org.jackhuang.hmcl.setting.Profile;
|
|||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardProvider;
|
import org.jackhuang.hmcl.ui.wizard.WizardProvider;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -80,8 +81,8 @@ public final class InstallerWizardProvider implements WizardProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object finish(Map<String, Object> settings) {
|
public Object finish(Map<String, Object> settings) {
|
||||||
settings.put("success_message", Launcher.i18n("install.success"));
|
settings.put("success_message", I18n.i18n("install.success"));
|
||||||
settings.put("failure_message", Launcher.i18n("install.failed"));
|
settings.put("failure_message", I18n.i18n("install.failed"));
|
||||||
|
|
||||||
Task ret = Task.empty();
|
Task ret = Task.empty();
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import javafx.fxml.FXML;
|
|||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.download.DownloadProvider;
|
import org.jackhuang.hmcl.download.DownloadProvider;
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
import org.jackhuang.hmcl.game.GameRepository;
|
import org.jackhuang.hmcl.game.GameRepository;
|
||||||
@@ -32,6 +32,7 @@ import org.jackhuang.hmcl.ui.construct.Validator;
|
|||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
||||||
import org.jackhuang.hmcl.util.StringUtils;
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -75,30 +76,30 @@ public class InstallersPage extends StackPane implements WizardPage {
|
|||||||
|
|
||||||
String gameVersion = ((RemoteVersion<?>) controller.getSettings().get("game")).getGameVersion();
|
String gameVersion = ((RemoteVersion<?>) controller.getSettings().get("game")).getGameVersion();
|
||||||
Validator hasVersion = new Validator(s -> !repository.hasVersion(s) && StringUtils.isNotBlank(s));
|
Validator hasVersion = new Validator(s -> !repository.hasVersion(s) && StringUtils.isNotBlank(s));
|
||||||
hasVersion.setMessage(Launcher.i18n("install.new_game.already_exists"));
|
hasVersion.setMessage(I18n.i18n("install.new_game.already_exists"));
|
||||||
txtName.getValidators().add(hasVersion);
|
txtName.getValidators().add(hasVersion);
|
||||||
txtName.textProperty().addListener(e -> btnInstall.setDisable(!txtName.validate()));
|
txtName.textProperty().addListener(e -> btnInstall.setDisable(!txtName.validate()));
|
||||||
txtName.setText(gameVersion);
|
txtName.setText(gameVersion);
|
||||||
|
|
||||||
btnForge.setOnMouseClicked(e -> {
|
btnForge.setOnMouseClicked(e -> {
|
||||||
controller.getSettings().put(INSTALLER_TYPE, 0);
|
controller.getSettings().put(INSTALLER_TYPE, 0);
|
||||||
controller.onNext(new VersionsPage(controller, Launcher.i18n("install.installer.choose", Launcher.i18n("install.installer.forge")), gameVersion, downloadProvider, "forge", () -> controller.onPrev(false)));
|
controller.onNext(new VersionsPage(controller, I18n.i18n("install.installer.choose", I18n.i18n("install.installer.forge")), gameVersion, downloadProvider, "forge", () -> controller.onPrev(false)));
|
||||||
});
|
});
|
||||||
|
|
||||||
btnLiteLoader.setOnMouseClicked(e -> {
|
btnLiteLoader.setOnMouseClicked(e -> {
|
||||||
controller.getSettings().put(INSTALLER_TYPE, 1);
|
controller.getSettings().put(INSTALLER_TYPE, 1);
|
||||||
controller.onNext(new VersionsPage(controller, Launcher.i18n("install.installer.choose", Launcher.i18n("install.installer.liteloader")), gameVersion, downloadProvider, "liteloader", () -> controller.onPrev(false)));
|
controller.onNext(new VersionsPage(controller, I18n.i18n("install.installer.choose", I18n.i18n("install.installer.liteloader")), gameVersion, downloadProvider, "liteloader", () -> controller.onPrev(false)));
|
||||||
});
|
});
|
||||||
|
|
||||||
btnOptiFine.setOnMouseClicked(e -> {
|
btnOptiFine.setOnMouseClicked(e -> {
|
||||||
controller.getSettings().put(INSTALLER_TYPE, 2);
|
controller.getSettings().put(INSTALLER_TYPE, 2);
|
||||||
controller.onNext(new VersionsPage(controller, Launcher.i18n("install.installer.choose", Launcher.i18n("install.installer.optifine")), gameVersion, downloadProvider, "optifine", () -> controller.onPrev(false)));
|
controller.onNext(new VersionsPage(controller, I18n.i18n("install.installer.choose", I18n.i18n("install.installer.optifine")), gameVersion, downloadProvider, "optifine", () -> controller.onPrev(false)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return Launcher.i18n("install.new_game");
|
return I18n.i18n("install.new_game");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getVersion(String id) {
|
private String getVersion(String id) {
|
||||||
@@ -107,21 +108,21 @@ public class InstallersPage extends StackPane implements WizardPage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNavigate(Map<String, Object> settings) {
|
public void onNavigate(Map<String, Object> settings) {
|
||||||
lblGameVersion.setText(Launcher.i18n("install.new_game.current_game_version") + ": " + getVersion("game"));
|
lblGameVersion.setText(I18n.i18n("install.new_game.current_game_version") + ": " + getVersion("game"));
|
||||||
if (controller.getSettings().containsKey("forge"))
|
if (controller.getSettings().containsKey("forge"))
|
||||||
lblForge.setText(Launcher.i18n("install.installer.version", Launcher.i18n("install.installer.forge")) + ": " + getVersion("forge"));
|
lblForge.setText(I18n.i18n("install.installer.version", I18n.i18n("install.installer.forge")) + ": " + getVersion("forge"));
|
||||||
else
|
else
|
||||||
lblForge.setText(Launcher.i18n("install.installer.not_installed", Launcher.i18n("install.installer.forge")));
|
lblForge.setText(I18n.i18n("install.installer.not_installed", I18n.i18n("install.installer.forge")));
|
||||||
|
|
||||||
if (controller.getSettings().containsKey("liteloader"))
|
if (controller.getSettings().containsKey("liteloader"))
|
||||||
lblLiteLoader.setText(Launcher.i18n("install.installer.version", Launcher.i18n("install.installer.liteloader")) + ": " + getVersion("liteloader"));
|
lblLiteLoader.setText(I18n.i18n("install.installer.version", I18n.i18n("install.installer.liteloader")) + ": " + getVersion("liteloader"));
|
||||||
else
|
else
|
||||||
lblLiteLoader.setText(Launcher.i18n("install.installer.not_installed", Launcher.i18n("install.installer.liteloader")));
|
lblLiteLoader.setText(I18n.i18n("install.installer.not_installed", I18n.i18n("install.installer.liteloader")));
|
||||||
|
|
||||||
if (controller.getSettings().containsKey("optifine"))
|
if (controller.getSettings().containsKey("optifine"))
|
||||||
lblOptiFine.setText(Launcher.i18n("install.installer.version", Launcher.i18n("install.installer.optifine")) + ": " + getVersion("optifine"));
|
lblOptiFine.setText(I18n.i18n("install.installer.version", I18n.i18n("install.installer.optifine")) + ": " + getVersion("optifine"));
|
||||||
else
|
else
|
||||||
lblOptiFine.setText(Launcher.i18n("install.installer.not_installed", Launcher.i18n("install.installer.optifine")));
|
lblOptiFine.setText(I18n.i18n("install.installer.not_installed", I18n.i18n("install.installer.optifine")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.game.ModpackHelper;
|
import org.jackhuang.hmcl.game.ModpackHelper;
|
||||||
import org.jackhuang.hmcl.mod.Modpack;
|
import org.jackhuang.hmcl.mod.Modpack;
|
||||||
import org.jackhuang.hmcl.mod.UnsupportedModpackException;
|
import org.jackhuang.hmcl.mod.UnsupportedModpackException;
|
||||||
@@ -37,6 +37,7 @@ import org.jackhuang.hmcl.ui.construct.Validator;
|
|||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
||||||
import org.jackhuang.hmcl.util.StringUtils;
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -75,16 +76,16 @@ public final class ModpackPage extends StackPane implements WizardPage {
|
|||||||
Profile profile = (Profile) controller.getSettings().get("PROFILE");
|
Profile profile = (Profile) controller.getSettings().get("PROFILE");
|
||||||
|
|
||||||
FileChooser chooser = new FileChooser();
|
FileChooser chooser = new FileChooser();
|
||||||
chooser.setTitle(Launcher.i18n("modpack.choose"));
|
chooser.setTitle(I18n.i18n("modpack.choose"));
|
||||||
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(Launcher.i18n("modpack"), "*.zip"));
|
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(I18n.i18n("modpack"), "*.zip"));
|
||||||
File selectedFile = chooser.showOpenDialog(Controllers.getStage());
|
File selectedFile = chooser.showOpenDialog(Controllers.getStage());
|
||||||
if (selectedFile == null) Platform.runLater(() -> Controllers.navigate(null));
|
if (selectedFile == null) Platform.runLater(() -> Controllers.navigate(null));
|
||||||
else {
|
else {
|
||||||
controller.getSettings().put(MODPACK_FILE, selectedFile);
|
controller.getSettings().put(MODPACK_FILE, selectedFile);
|
||||||
lblModpackLocation.setText(selectedFile.getAbsolutePath());
|
lblModpackLocation.setText(selectedFile.getAbsolutePath());
|
||||||
txtModpackName.getValidators().addAll(
|
txtModpackName.getValidators().addAll(
|
||||||
new Validator(Launcher.i18n("install.new_game.already_exists"), str -> !profile.getRepository().hasVersion(str) && StringUtils.isNotBlank(str)),
|
new Validator(I18n.i18n("install.new_game.already_exists"), str -> !profile.getRepository().hasVersion(str) && StringUtils.isNotBlank(str)),
|
||||||
new Validator(Launcher.i18n("version.forbidden_name"), str -> !profile.getRepository().forbidsVersion(str))
|
new Validator(I18n.i18n("version.forbidden_name"), str -> !profile.getRepository().forbidsVersion(str))
|
||||||
);
|
);
|
||||||
txtModpackName.textProperty().addListener(e -> btnInstall.setDisable(!txtModpackName.validate()));
|
txtModpackName.textProperty().addListener(e -> btnInstall.setDisable(!txtModpackName.validate()));
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ public final class ModpackPage extends StackPane implements WizardPage {
|
|||||||
lblAuthor.setText(manifest.getAuthor());
|
lblAuthor.setText(manifest.getAuthor());
|
||||||
txtModpackName.setText(manifest.getName() + (StringUtils.isBlank(manifest.getVersion()) ? "" : "-" + manifest.getVersion()));
|
txtModpackName.setText(manifest.getName() + (StringUtils.isBlank(manifest.getVersion()) ? "" : "-" + manifest.getVersion()));
|
||||||
} catch (UnsupportedModpackException e) {
|
} catch (UnsupportedModpackException e) {
|
||||||
txtModpackName.setText(Launcher.i18n("modpack.task.install.error"));
|
txtModpackName.setText(I18n.i18n("modpack.task.install.error"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,14 +119,14 @@ public final class ModpackPage extends StackPane implements WizardPage {
|
|||||||
if (manifest != null) {
|
if (manifest != null) {
|
||||||
WebStage stage = new WebStage();
|
WebStage stage = new WebStage();
|
||||||
stage.getWebView().getEngine().loadContent(manifest.getDescription());
|
stage.getWebView().getEngine().loadContent(manifest.getDescription());
|
||||||
stage.setTitle(Launcher.i18n("modpack.wizard.step.3"));
|
stage.setTitle(I18n.i18n("modpack.wizard.step.3"));
|
||||||
stage.showAndWait();
|
stage.showAndWait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return Launcher.i18n("modpack.task.install");
|
return I18n.i18n("modpack.task.install");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String MODPACK_FILE = "MODPACK_FILE";
|
public static final String MODPACK_FILE = "MODPACK_FILE";
|
||||||
|
|||||||
@@ -23,12 +23,13 @@ import javafx.scene.image.Image;
|
|||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
import org.jackhuang.hmcl.download.game.GameRemoteVersionTag;
|
import org.jackhuang.hmcl.download.game.GameRemoteVersionTag;
|
||||||
import org.jackhuang.hmcl.download.liteloader.LiteLoaderRemoteVersionTag;
|
import org.jackhuang.hmcl.download.liteloader.LiteLoaderRemoteVersionTag;
|
||||||
import org.jackhuang.hmcl.download.optifine.OptiFineRemoteVersion;
|
import org.jackhuang.hmcl.download.optifine.OptiFineRemoteVersion;
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -57,15 +58,15 @@ public final class VersionsPageItem extends StackPane {
|
|||||||
if (remoteVersion.getTag() instanceof GameRemoteVersionTag) {
|
if (remoteVersion.getTag() instanceof GameRemoteVersionTag) {
|
||||||
switch (((GameRemoteVersionTag) remoteVersion.getTag()).getType()) {
|
switch (((GameRemoteVersionTag) remoteVersion.getTag()).getType()) {
|
||||||
case RELEASE:
|
case RELEASE:
|
||||||
lblGameVersion.setText(Launcher.i18n("version.game.release"));
|
lblGameVersion.setText(I18n.i18n("version.game.release"));
|
||||||
imageView.setImage(new Image("/assets/img/icon.png", 32, 32, false, true));
|
imageView.setImage(new Image("/assets/img/icon.png", 32, 32, false, true));
|
||||||
break;
|
break;
|
||||||
case SNAPSHOT:
|
case SNAPSHOT:
|
||||||
lblGameVersion.setText(Launcher.i18n("version.game.snapshot"));
|
lblGameVersion.setText(I18n.i18n("version.game.snapshot"));
|
||||||
imageView.setImage(new Image("/assets/img/command.png", 32, 32, false, true));
|
imageView.setImage(new Image("/assets/img/command.png", 32, 32, false, true));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lblGameVersion.setText(Launcher.i18n("version.game.old"));
|
lblGameVersion.setText(I18n.i18n("version.game.old"));
|
||||||
imageView.setImage(new Image("/assets/img/grass.png", 32, 32, false, true));
|
imageView.setImage(new Image("/assets/img/grass.png", 32, 32, false, true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.control.TreeItem;
|
import javafx.scene.control.TreeItem;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.game.ModAdviser;
|
import org.jackhuang.hmcl.game.ModAdviser;
|
||||||
import org.jackhuang.hmcl.setting.Profile;
|
import org.jackhuang.hmcl.setting.Profile;
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
@@ -34,6 +34,7 @@ import org.jackhuang.hmcl.ui.wizard.WizardController;
|
|||||||
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
||||||
import org.jackhuang.hmcl.util.FileUtils;
|
import org.jackhuang.hmcl.util.FileUtils;
|
||||||
import org.jackhuang.hmcl.util.StringUtils;
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@@ -151,23 +152,23 @@ public final class ModpackFileSelectionPage extends StackPane implements WizardP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return Launcher.i18n("modpack.wizard.step.2.title");
|
return I18n.i18n("modpack.wizard.step.2.title");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String MODPACK_FILE_SELECTION = "modpack.accepted";
|
public static final String MODPACK_FILE_SELECTION = "modpack.accepted";
|
||||||
private static final Map<String, String> TRANSLATION = mapOf(
|
private static final Map<String, String> TRANSLATION = mapOf(
|
||||||
pair("minecraft/servers.dat", Launcher.i18n("modpack.files.servers_dat")),
|
pair("minecraft/servers.dat", I18n.i18n("modpack.files.servers_dat")),
|
||||||
pair("minecraft/saves", Launcher.i18n("modpack.files.saves")),
|
pair("minecraft/saves", I18n.i18n("modpack.files.saves")),
|
||||||
pair("minecraft/mods", Launcher.i18n("modpack.files.mods")),
|
pair("minecraft/mods", I18n.i18n("modpack.files.mods")),
|
||||||
pair("minecraft/config", Launcher.i18n("modpack.files.config")),
|
pair("minecraft/config", I18n.i18n("modpack.files.config")),
|
||||||
pair("minecraft/liteconfig", Launcher.i18n("modpack.files.liteconfig")),
|
pair("minecraft/liteconfig", I18n.i18n("modpack.files.liteconfig")),
|
||||||
pair("minecraft/resourcepacks", Launcher.i18n("modpack.files.resourcepacks")),
|
pair("minecraft/resourcepacks", I18n.i18n("modpack.files.resourcepacks")),
|
||||||
pair("minecraft/resources", Launcher.i18n("modpack.files.resourcepacks")),
|
pair("minecraft/resources", I18n.i18n("modpack.files.resourcepacks")),
|
||||||
pair("minecraft/options.txt", Launcher.i18n("modpack.files.options_txt")),
|
pair("minecraft/options.txt", I18n.i18n("modpack.files.options_txt")),
|
||||||
pair("minecraft/optionsshaders.txt", Launcher.i18n("modpack.files.optionsshaders_txt")),
|
pair("minecraft/optionsshaders.txt", I18n.i18n("modpack.files.optionsshaders_txt")),
|
||||||
pair("minecraft/mods/VoxelMods", Launcher.i18n("modpack.files.mods.voxelmods")),
|
pair("minecraft/mods/VoxelMods", I18n.i18n("modpack.files.mods.voxelmods")),
|
||||||
pair("minecraft/dumps", Launcher.i18n("modpack.files.dumps")),
|
pair("minecraft/dumps", I18n.i18n("modpack.files.dumps")),
|
||||||
pair("minecraft/blueprints", Launcher.i18n("modpack.files.blueprints")),
|
pair("minecraft/blueprints", I18n.i18n("modpack.files.blueprints")),
|
||||||
pair("minecraft/scripts", Launcher.i18n("modpack.files.scripts"))
|
pair("minecraft/scripts", I18n.i18n("modpack.files.scripts"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import org.jackhuang.hmcl.ui.Controllers;
|
|||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -81,8 +82,8 @@ public final class ModpackInfoPage extends StackPane implements WizardPage {
|
|||||||
@FXML
|
@FXML
|
||||||
private void onNext() {
|
private void onNext() {
|
||||||
FileChooser fileChooser = new FileChooser();
|
FileChooser fileChooser = new FileChooser();
|
||||||
fileChooser.setTitle(Launcher.i18n("modpack.wizard.step.initialization.save"));
|
fileChooser.setTitle(I18n.i18n("modpack.wizard.step.initialization.save"));
|
||||||
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(Launcher.i18n("modpack"), "*.zip"));
|
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(I18n.i18n("modpack"), "*.zip"));
|
||||||
File file = fileChooser.showSaveDialog(Controllers.getStage());
|
File file = fileChooser.showSaveDialog(Controllers.getStage());
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
Controllers.navigate(null);
|
Controllers.navigate(null);
|
||||||
@@ -109,7 +110,7 @@ public final class ModpackInfoPage extends StackPane implements WizardPage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return Launcher.i18n("modpack.wizard.step.1.title");
|
return I18n.i18n("modpack.wizard.step.1.title");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String MODPACK_NAME = "modpack.name";
|
public static final String MODPACK_NAME = "modpack.name";
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.jackhuang.hmcl.task.TaskExecutor;
|
|||||||
import org.jackhuang.hmcl.ui.Controllers;
|
import org.jackhuang.hmcl.ui.Controllers;
|
||||||
import org.jackhuang.hmcl.ui.construct.MessageBox;
|
import org.jackhuang.hmcl.ui.construct.MessageBox;
|
||||||
import org.jackhuang.hmcl.util.*;
|
import org.jackhuang.hmcl.util.*;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@@ -113,7 +114,7 @@ public class AppDataUpgrader extends IUpgrader {
|
|||||||
Task task = new AppDataUpgraderJarTask(NetworkUtils.toURL(map.get("jar")), version.toString(), hash);
|
Task task = new AppDataUpgraderJarTask(NetworkUtils.toURL(map.get("jar")), version.toString(), hash);
|
||||||
TaskExecutor executor = task.executor();
|
TaskExecutor executor = task.executor();
|
||||||
AtomicReference<Region> region = new AtomicReference<>();
|
AtomicReference<Region> region = new AtomicReference<>();
|
||||||
JFXUtilities.runInFX(() -> region.set(Controllers.taskDialog(executor, Launcher.i18n("message.downloading"), "", null)));
|
JFXUtilities.runInFX(() -> region.set(Controllers.taskDialog(executor, I18n.i18n("message.downloading"), "", null)));
|
||||||
if (executor.test()) {
|
if (executor.test()) {
|
||||||
new ProcessBuilder(JavaVersion.fromCurrentEnvironment().getBinary().getAbsolutePath(), "-jar", AppDataUpgraderJarTask.getSelf(version.toString()).getAbsolutePath())
|
new ProcessBuilder(JavaVersion.fromCurrentEnvironment().getBinary().getAbsolutePath(), "-jar", AppDataUpgraderJarTask.getSelf(version.toString()).getAbsolutePath())
|
||||||
.directory(new File("").getAbsoluteFile()).start();
|
.directory(new File("").getAbsoluteFile()).start();
|
||||||
@@ -131,7 +132,7 @@ public class AppDataUpgrader extends IUpgrader {
|
|||||||
Task task = new AppDataUpgraderPackGzTask(NetworkUtils.toURL(map.get("pack")), version.toString(), hash);
|
Task task = new AppDataUpgraderPackGzTask(NetworkUtils.toURL(map.get("pack")), version.toString(), hash);
|
||||||
TaskExecutor executor = task.executor();
|
TaskExecutor executor = task.executor();
|
||||||
AtomicReference<Region> region = new AtomicReference<>();
|
AtomicReference<Region> region = new AtomicReference<>();
|
||||||
JFXUtilities.runInFX(() -> region.set(Controllers.taskDialog(executor, Launcher.i18n("message.downloading"), "", null)));
|
JFXUtilities.runInFX(() -> region.set(Controllers.taskDialog(executor, I18n.i18n("message.downloading"), "", null)));
|
||||||
if (executor.test()) {
|
if (executor.test()) {
|
||||||
new ProcessBuilder(JavaVersion.fromCurrentEnvironment().getBinary().getAbsolutePath(), "-jar", AppDataUpgraderPackGzTask.getSelf(version.toString()).getAbsolutePath())
|
new ProcessBuilder(JavaVersion.fromCurrentEnvironment().getBinary().getAbsolutePath(), "-jar", AppDataUpgraderPackGzTask.getSelf(version.toString()).getAbsolutePath())
|
||||||
.directory(new File("").getAbsoluteFile()).start();
|
.directory(new File("").getAbsoluteFile()).start();
|
||||||
@@ -153,7 +154,7 @@ public class AppDataUpgrader extends IUpgrader {
|
|||||||
} catch (URISyntaxException | IOException e) {
|
} catch (URISyntaxException | IOException e) {
|
||||||
Logging.LOG.log(Level.SEVERE, "Failed to browse uri: " + url, e);
|
Logging.LOG.log(Level.SEVERE, "Failed to browse uri: " + url, e);
|
||||||
OperatingSystem.setClipboard(url);
|
OperatingSystem.setClipboard(url);
|
||||||
MessageBox.show(Launcher.i18n("update.no_browser"));
|
MessageBox.show(I18n.i18n("update.no_browser"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})).start();
|
})).start();
|
||||||
|
|||||||
@@ -19,13 +19,14 @@ package org.jackhuang.hmcl.upgrade;
|
|||||||
|
|
||||||
import com.jfoenix.concurrency.JFXUtilities;
|
import com.jfoenix.concurrency.JFXUtilities;
|
||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
|
||||||
import org.jackhuang.hmcl.task.FileDownloadTask;
|
import org.jackhuang.hmcl.task.FileDownloadTask;
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.task.TaskExecutor;
|
import org.jackhuang.hmcl.task.TaskExecutor;
|
||||||
import org.jackhuang.hmcl.ui.Controllers;
|
import org.jackhuang.hmcl.ui.Controllers;
|
||||||
import org.jackhuang.hmcl.util.Logging;
|
import org.jackhuang.hmcl.util.Logging;
|
||||||
import org.jackhuang.hmcl.util.VersionNumber;
|
import org.jackhuang.hmcl.util.VersionNumber;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -57,11 +58,11 @@ public class NewFileUpgrader extends IUpgrader {
|
|||||||
URL url = requestDownloadLink();
|
URL url = requestDownloadLink();
|
||||||
if (url == null) return;
|
if (url == null) return;
|
||||||
File newf = new File(url.getFile());
|
File newf = new File(url.getFile());
|
||||||
Controllers.dialog(Launcher.i18n("message.downloading"));
|
Controllers.dialog(I18n.i18n("message.downloading"));
|
||||||
Task task = new FileDownloadTask(url, newf);
|
Task task = new FileDownloadTask(url, newf);
|
||||||
TaskExecutor executor = task.executor();
|
TaskExecutor executor = task.executor();
|
||||||
AtomicReference<Region> region = new AtomicReference<>();
|
AtomicReference<Region> region = new AtomicReference<>();
|
||||||
JFXUtilities.runInFX(() -> region.set(Controllers.taskDialog(executor, Launcher.i18n("message.downloading"), "", null)));
|
JFXUtilities.runInFX(() -> region.set(Controllers.taskDialog(executor, I18n.i18n("message.downloading"), "", null)));
|
||||||
if (executor.test()) {
|
if (executor.test()) {
|
||||||
try {
|
try {
|
||||||
new ProcessBuilder(newf.getCanonicalPath(), "--removeOldLauncher", getRealPath())
|
new ProcessBuilder(newf.getCanonicalPath(), "--removeOldLauncher", getRealPath())
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.jackhuang.hmcl.ui.construct.MessageBox;
|
|||||||
import org.jackhuang.hmcl.util.Constants;
|
import org.jackhuang.hmcl.util.Constants;
|
||||||
import org.jackhuang.hmcl.util.NetworkUtils;
|
import org.jackhuang.hmcl.util.NetworkUtils;
|
||||||
import org.jackhuang.hmcl.util.VersionNumber;
|
import org.jackhuang.hmcl.util.VersionNumber;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.util.Logging.LOG;
|
import static org.jackhuang.hmcl.util.Logging.LOG;
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ public final class UpdateChecker {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
LOG.warning("Unable to check update...");
|
LOG.warning("Unable to check update...");
|
||||||
if (showMessage)
|
if (showMessage)
|
||||||
MessageBox.show(Launcher.i18n("update.failed"));
|
MessageBox.show(I18n.i18n("update.failed"));
|
||||||
} else if (base.compareTo(value) < 0)
|
} else if (base.compareTo(value) < 0)
|
||||||
outOfDate = true;
|
outOfDate = true;
|
||||||
if (outOfDate)
|
if (outOfDate)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import javafx.application.Platform;
|
|||||||
import org.jackhuang.hmcl.Launcher;
|
import org.jackhuang.hmcl.Launcher;
|
||||||
import org.jackhuang.hmcl.ui.CrashWindow;
|
import org.jackhuang.hmcl.ui.CrashWindow;
|
||||||
import org.jackhuang.hmcl.ui.construct.MessageBox;
|
import org.jackhuang.hmcl.ui.construct.MessageBox;
|
||||||
|
import org.jackhuang.hmcl.util.i18n.I18n;
|
||||||
|
|
||||||
import static java.util.Collections.newSetFromMap;
|
import static java.util.Collections.newSetFromMap;
|
||||||
import static org.jackhuang.hmcl.util.Logging.LOG;
|
import static org.jackhuang.hmcl.util.Logging.LOG;
|
||||||
@@ -41,19 +42,19 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
|||||||
|
|
||||||
private static final Map<String, String> SOURCE = new HashMap<String, String>() {
|
private static final Map<String, String> SOURCE = new HashMap<String, String>() {
|
||||||
{
|
{
|
||||||
put("javafx.fxml.LoadException", Launcher.i18n("crash.NoClassDefFound"));
|
put("javafx.fxml.LoadException", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("Location is not set", Launcher.i18n("crash.NoClassDefFound"));
|
put("Location is not set", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("UnsatisfiedLinkError", Launcher.i18n("crash.user_fault"));
|
put("UnsatisfiedLinkError", I18n.i18n("crash.user_fault"));
|
||||||
put("java.lang.NoClassDefFoundError", Launcher.i18n("crash.NoClassDefFound"));
|
put("java.lang.NoClassDefFoundError", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("java.lang.VerifyError", Launcher.i18n("crash.NoClassDefFound"));
|
put("java.lang.VerifyError", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("java.lang.NoSuchMethodError", Launcher.i18n("crash.NoClassDefFound"));
|
put("java.lang.NoSuchMethodError", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("java.lang.NoSuchFieldError", Launcher.i18n("crash.NoClassDefFound"));
|
put("java.lang.NoSuchFieldError", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("netscape.javascript.JSException", Launcher.i18n("crash.NoClassDefFound"));
|
put("netscape.javascript.JSException", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("java.lang.IncompatibleClassChangeError", Launcher.i18n("crash.NoClassDefFound"));
|
put("java.lang.IncompatibleClassChangeError", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("java.lang.ClassFormatError", Launcher.i18n("crash.NoClassDefFound"));
|
put("java.lang.ClassFormatError", I18n.i18n("crash.NoClassDefFound"));
|
||||||
put("java.lang.OutOfMemoryError", "FUCKING MEMORY LIMIT!");
|
put("java.lang.OutOfMemoryError", "FUCKING MEMORY LIMIT!");
|
||||||
put("Trampoline", Launcher.i18n("launcher.update_java"));
|
put("Trampoline", I18n.i18n("launcher.update_java"));
|
||||||
put("com.sun.javafx.css.StyleManager.findMatchingStyles", Launcher.i18n("launcher.update_java"));
|
put("com.sun.javafx.css.StyleManager.findMatchingStyles", I18n.i18n("launcher.update_java"));
|
||||||
put("NoSuchAlgorithmException", "Has your operating system been installed completely or is a ghost system?");
|
put("NoSuchAlgorithmException", "Has your operating system been installed completely or is a ghost system?");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
45
HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/I18n.java
Normal file
45
HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/I18n.java
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher.
|
||||||
|
* Copyright (C) 2018 huangyuhui <huanghongxun2008@126.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hmcl.util.i18n;
|
||||||
|
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.jackhuang.hmcl.setting.Settings;
|
||||||
|
import org.jackhuang.hmcl.util.Logging;
|
||||||
|
|
||||||
|
public final class I18n {
|
||||||
|
|
||||||
|
public static final ResourceBundle RESOURCE_BUNDLE = Settings.INSTANCE.getLocale().getResourceBundle();
|
||||||
|
|
||||||
|
private I18n() {}
|
||||||
|
|
||||||
|
public static String i18n(String key, Object... formatArgs) {
|
||||||
|
return String.format(I18n.i18n(key), formatArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String i18n(String key) {
|
||||||
|
try {
|
||||||
|
return RESOURCE_BUNDLE.getString(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logging.LOG.log(Level.SEVERE, "Cannot find key " + key + " in resource bundle", e);
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,7 +15,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.util;
|
package org.jackhuang.hmcl.util.i18n;
|
||||||
|
|
||||||
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
|
||||||
public class I18nException extends Exception {
|
public class I18nException extends Exception {
|
||||||
private final String localizedMessage;
|
private final String localizedMessage;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Hello Minecraft! Launcher.
|
* Hello Minecraft! Launcher.
|
||||||
* Copyright (C) 2018 huangyuhui <huanghongxun2008@126.com>
|
* Copyright (C) 2018 huangyuhui <huanghongxun2008@126.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -15,9 +15,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.setting;
|
package org.jackhuang.hmcl.util.i18n;
|
||||||
|
|
||||||
import org.jackhuang.hmcl.ui.construct.UTF8Control;
|
|
||||||
import org.jackhuang.hmcl.util.Lang;
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Hello Minecraft! Launcher.
|
* Hello Minecraft! Launcher.
|
||||||
* Copyright (C) 2018 huangyuhui <huanghongxun2008@126.com>
|
* Copyright (C) 2018 huangyuhui <huanghongxun2008@126.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -15,7 +15,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.ui.construct;
|
package org.jackhuang.hmcl.util.i18n;
|
||||||
|
|
||||||
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -26,14 +28,14 @@ import java.util.Locale;
|
|||||||
import java.util.PropertyResourceBundle;
|
import java.util.PropertyResourceBundle;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public final class UTF8Control extends ResourceBundle.Control {
|
final class UTF8Control extends ResourceBundle.Control {
|
||||||
|
|
||||||
public static final UTF8Control INSTANCE = new UTF8Control();
|
public static final UTF8Control INSTANCE = new UTF8Control();
|
||||||
|
|
||||||
private UTF8Control() {}
|
private UTF8Control() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)
|
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IOException {
|
||||||
throws IOException {
|
|
||||||
// The below is a copy of the default implementation.
|
// The below is a copy of the default implementation.
|
||||||
String bundleName = toBundleName(baseName, locale);
|
String bundleName = toBundleName(baseName, locale);
|
||||||
String resourceName = toResourceName(bundleName, "properties");
|
String resourceName = toResourceName(bundleName, "properties");
|
||||||
@@ -54,7 +56,7 @@ public final class UTF8Control extends ResourceBundle.Control {
|
|||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
try {
|
try {
|
||||||
// Only this line is changed to make it to read properties files as UTF-8.
|
// Only this line is changed to make it to read properties files as UTF-8.
|
||||||
bundle = new PropertyResourceBundle(new InputStreamReader(stream, "UTF-8"));
|
bundle = new PropertyResourceBundle(new InputStreamReader(stream, UTF_8));
|
||||||
} finally {
|
} finally {
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user