mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-24 12:16:28 +01:00
Rename SharedLocale._() to tr().
This commit is contained in:
parent
5b6681b8ea
commit
c41fb73bd1
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a directory that stores assets for Minecraft. The class has
|
* Represents a directory that stores assets for Minecraft. The class has
|
||||||
@ -79,7 +79,7 @@ public class AssetsRoot {
|
|||||||
File path = getIndexPath(versionManifest);
|
File path = getIndexPath(versionManifest);
|
||||||
AssetsIndex index = Persistence.read(path, AssetsIndex.class, true);
|
AssetsIndex index = Persistence.read(path, AssetsIndex.class, true);
|
||||||
if (index == null || index.getObjects() == null) {
|
if (index == null || index.getObjects() == null) {
|
||||||
throw new LauncherException("Missing index at " + path, _("assets.missingIndex", path.getAbsolutePath()));
|
throw new LauncherException("Missing index at " + path, tr("assets.missingIndex", path.getAbsolutePath()));
|
||||||
}
|
}
|
||||||
File treeDir = new File(dir, "virtual/" + indexId);
|
File treeDir = new File(dir, "virtual/" + indexId);
|
||||||
treeDir.mkdirs();
|
treeDir.mkdirs();
|
||||||
@ -110,7 +110,7 @@ public class AssetsRoot {
|
|||||||
objectPath.getAbsolutePath(), virtualPath.getAbsolutePath()});
|
objectPath.getAbsolutePath(), virtualPath.getAbsolutePath()});
|
||||||
|
|
||||||
if (!objectPath.exists()) {
|
if (!objectPath.exists()) {
|
||||||
String message = _("assets.missingObject", objectPath.getAbsolutePath());
|
String message = tr("assets.missingObject", objectPath.getAbsolutePath());
|
||||||
throw new LauncherException("Missing object " + objectPath.getAbsolutePath(), message);
|
throw new LauncherException("Missing object " + objectPath.getAbsolutePath(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,9 +134,9 @@ public class AssetsRoot {
|
|||||||
@Override
|
@Override
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
return _("assets.expanding1", count, count - processed);
|
return tr("assets.expanding1", count, count - processed);
|
||||||
} else {
|
} else {
|
||||||
return _("assets.expandingN", count, count - processed);
|
return tr("assets.expandingN", count, count - processed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import com.skcraft.launcher.model.modpack.ManifestInfo;
|
|||||||
import com.skcraft.launcher.model.modpack.PackageList;
|
import com.skcraft.launcher.model.modpack.PackageList;
|
||||||
import com.skcraft.launcher.persistence.Persistence;
|
import com.skcraft.launcher.persistence.Persistence;
|
||||||
import com.skcraft.launcher.util.HttpRequest;
|
import com.skcraft.launcher.util.HttpRequest;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
@ -27,7 +28,6 @@ import java.util.List;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import static com.skcraft.launcher.LauncherUtils.concat;
|
import static com.skcraft.launcher.LauncherUtils.concat;
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the list of instances.
|
* Stores the list of instances.
|
||||||
@ -108,7 +108,7 @@ public class InstanceList {
|
|||||||
@Override
|
@Override
|
||||||
public InstanceList call() throws Exception {
|
public InstanceList call() throws Exception {
|
||||||
log.info("Enumerating instance list...");
|
log.info("Enumerating instance list...");
|
||||||
progress = new DefaultProgress(0, _("instanceLoader.loadingLocal"));
|
progress = new DefaultProgress(0, SharedLocale.tr("instanceLoader.loadingLocal"));
|
||||||
|
|
||||||
List<Instance> local = new ArrayList<Instance>();
|
List<Instance> local = new ArrayList<Instance>();
|
||||||
List<Instance> remote = new ArrayList<Instance>();
|
List<Instance> remote = new ArrayList<Instance>();
|
||||||
@ -128,7 +128,7 @@ public class InstanceList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
progress = new DefaultProgress(0.3, _("instanceLoader.checkingRemote"));
|
progress = new DefaultProgress(0.3, SharedLocale.tr("instanceLoader.checkingRemote"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URL packagesURL = launcher.getPackagesURL();
|
URL packagesURL = launcher.getPackagesURL();
|
||||||
@ -141,7 +141,7 @@ public class InstanceList {
|
|||||||
.asJson(PackageList.class);
|
.asJson(PackageList.class);
|
||||||
|
|
||||||
if (packages.getMinimumVersion() > Launcher.PROTOCOL_VERSION) {
|
if (packages.getMinimumVersion() > Launcher.PROTOCOL_VERSION) {
|
||||||
throw new LauncherException("Update required", _("errors.updateRequiredError"));
|
throw new LauncherException("Update required", SharedLocale.tr("errors.updateRequiredError"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ManifestInfo manifest : packages.getPackages()) {
|
for (ManifestInfo manifest : packages.getPackages()) {
|
||||||
|
@ -10,6 +10,7 @@ import com.skcraft.launcher.Configuration;
|
|||||||
import com.skcraft.launcher.Launcher;
|
import com.skcraft.launcher.Launcher;
|
||||||
import com.skcraft.launcher.swing.*;
|
import com.skcraft.launcher.swing.*;
|
||||||
import com.skcraft.launcher.persistence.Persistence;
|
import com.skcraft.launcher.persistence.Persistence;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@ -17,8 +18,6 @@ import java.awt.*;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dialog to modify configuration options.
|
* A dialog to modify configuration options.
|
||||||
*/
|
*/
|
||||||
@ -39,7 +38,7 @@ public class ConfigurationDialog extends JDialog {
|
|||||||
private final JSpinner widthSpinner = new JSpinner();
|
private final JSpinner widthSpinner = new JSpinner();
|
||||||
private final JSpinner heightSpinner = new JSpinner();
|
private final JSpinner heightSpinner = new JSpinner();
|
||||||
private final FormPanel proxySettingsPanel = new FormPanel();
|
private final FormPanel proxySettingsPanel = new FormPanel();
|
||||||
private final JCheckBox useProxyCheck = new JCheckBox(_("options.useProxyCheck"));
|
private final JCheckBox useProxyCheck = new JCheckBox(SharedLocale.tr("options.useProxyCheck"));
|
||||||
private final JTextField proxyHostText = new JTextField();
|
private final JTextField proxyHostText = new JTextField();
|
||||||
private final JSpinner proxyPortText = new JSpinner();
|
private final JSpinner proxyPortText = new JSpinner();
|
||||||
private final JTextField proxyUsernameText = new JTextField();
|
private final JTextField proxyUsernameText = new JTextField();
|
||||||
@ -47,9 +46,9 @@ public class ConfigurationDialog extends JDialog {
|
|||||||
private final FormPanel advancedPanel = new FormPanel();
|
private final FormPanel advancedPanel = new FormPanel();
|
||||||
private final JTextField gameKeyText = new JTextField();
|
private final JTextField gameKeyText = new JTextField();
|
||||||
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true);
|
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true);
|
||||||
private final JButton okButton = new JButton(_("button.ok"));
|
private final JButton okButton = new JButton(SharedLocale.tr("button.ok"));
|
||||||
private final JButton cancelButton = new JButton(_("button.cancel"));
|
private final JButton cancelButton = new JButton(SharedLocale.tr("button.cancel"));
|
||||||
private final JButton logButton = new JButton(_("options.launcherConsole"));
|
private final JButton logButton = new JButton(SharedLocale.tr("options.launcherConsole"));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new configuration dialog.
|
* Create a new configuration dialog.
|
||||||
@ -63,7 +62,7 @@ public class ConfigurationDialog extends JDialog {
|
|||||||
this.config = launcher.getConfig();
|
this.config = launcher.getConfig();
|
||||||
mapper = new ObjectSwingMapper(config);
|
mapper = new ObjectSwingMapper(config);
|
||||||
|
|
||||||
setTitle(_("options.title"));
|
setTitle(SharedLocale.tr("options.title"));
|
||||||
initComponents();
|
initComponents();
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
setSize(new Dimension(400, 500));
|
setSize(new Dimension(400, 500));
|
||||||
@ -88,32 +87,32 @@ public class ConfigurationDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
javaSettingsPanel.addRow(new JLabel(_("options.jvmPath")), jvmPathText);
|
javaSettingsPanel.addRow(new JLabel(SharedLocale.tr("options.jvmPath")), jvmPathText);
|
||||||
javaSettingsPanel.addRow(new JLabel(_("options.jvmArguments")), jvmArgsText);
|
javaSettingsPanel.addRow(new JLabel(SharedLocale.tr("options.jvmArguments")), jvmArgsText);
|
||||||
javaSettingsPanel.addRow(Box.createVerticalStrut(15));
|
javaSettingsPanel.addRow(Box.createVerticalStrut(15));
|
||||||
javaSettingsPanel.addRow(new JLabel(_("options.64BitJavaWarning")));
|
javaSettingsPanel.addRow(new JLabel(SharedLocale.tr("options.64BitJavaWarning")));
|
||||||
javaSettingsPanel.addRow(new JLabel(_("options.minMemory")), minMemorySpinner);
|
javaSettingsPanel.addRow(new JLabel(SharedLocale.tr("options.minMemory")), minMemorySpinner);
|
||||||
javaSettingsPanel.addRow(new JLabel(_("options.maxMemory")), maxMemorySpinner);
|
javaSettingsPanel.addRow(new JLabel(SharedLocale.tr("options.maxMemory")), maxMemorySpinner);
|
||||||
javaSettingsPanel.addRow(new JLabel(_("options.permGen")), permGenSpinner);
|
javaSettingsPanel.addRow(new JLabel(SharedLocale.tr("options.permGen")), permGenSpinner);
|
||||||
SwingHelper.removeOpaqueness(javaSettingsPanel);
|
SwingHelper.removeOpaqueness(javaSettingsPanel);
|
||||||
tabbedPane.addTab(_("options.javaTab"), SwingHelper.alignTabbedPane(javaSettingsPanel));
|
tabbedPane.addTab(SharedLocale.tr("options.javaTab"), SwingHelper.alignTabbedPane(javaSettingsPanel));
|
||||||
|
|
||||||
gameSettingsPanel.addRow(new JLabel(_("options.windowWidth")), widthSpinner);
|
gameSettingsPanel.addRow(new JLabel(SharedLocale.tr("options.windowWidth")), widthSpinner);
|
||||||
gameSettingsPanel.addRow(new JLabel(_("options.windowHeight")), heightSpinner);
|
gameSettingsPanel.addRow(new JLabel(SharedLocale.tr("options.windowHeight")), heightSpinner);
|
||||||
SwingHelper.removeOpaqueness(gameSettingsPanel);
|
SwingHelper.removeOpaqueness(gameSettingsPanel);
|
||||||
tabbedPane.addTab(_("options.minecraftTab"), SwingHelper.alignTabbedPane(gameSettingsPanel));
|
tabbedPane.addTab(SharedLocale.tr("options.minecraftTab"), SwingHelper.alignTabbedPane(gameSettingsPanel));
|
||||||
|
|
||||||
proxySettingsPanel.addRow(useProxyCheck);
|
proxySettingsPanel.addRow(useProxyCheck);
|
||||||
proxySettingsPanel.addRow(new JLabel(_("options.proxyHost")), proxyHostText);
|
proxySettingsPanel.addRow(new JLabel(SharedLocale.tr("options.proxyHost")), proxyHostText);
|
||||||
proxySettingsPanel.addRow(new JLabel(_("options.proxyPort")), proxyPortText);
|
proxySettingsPanel.addRow(new JLabel(SharedLocale.tr("options.proxyPort")), proxyPortText);
|
||||||
proxySettingsPanel.addRow(new JLabel(_("options.proxyUsername")), proxyUsernameText);
|
proxySettingsPanel.addRow(new JLabel(SharedLocale.tr("options.proxyUsername")), proxyUsernameText);
|
||||||
proxySettingsPanel.addRow(new JLabel(_("options.proxyPassword")), proxyPasswordText);
|
proxySettingsPanel.addRow(new JLabel(SharedLocale.tr("options.proxyPassword")), proxyPasswordText);
|
||||||
SwingHelper.removeOpaqueness(proxySettingsPanel);
|
SwingHelper.removeOpaqueness(proxySettingsPanel);
|
||||||
tabbedPane.addTab(_("options.proxyTab"), SwingHelper.alignTabbedPane(proxySettingsPanel));
|
tabbedPane.addTab(SharedLocale.tr("options.proxyTab"), SwingHelper.alignTabbedPane(proxySettingsPanel));
|
||||||
|
|
||||||
advancedPanel.addRow(new JLabel(_("options.gameKey")), gameKeyText);
|
advancedPanel.addRow(new JLabel(SharedLocale.tr("options.gameKey")), gameKeyText);
|
||||||
SwingHelper.removeOpaqueness(advancedPanel);
|
SwingHelper.removeOpaqueness(advancedPanel);
|
||||||
tabbedPane.addTab(_("options.advancedTab"), SwingHelper.alignTabbedPane(advancedPanel));
|
tabbedPane.addTab(SharedLocale.tr("options.advancedTab"), SwingHelper.alignTabbedPane(advancedPanel));
|
||||||
|
|
||||||
buttonsPanel.addElement(logButton);
|
buttonsPanel.addElement(logButton);
|
||||||
buttonsPanel.addGlue();
|
buttonsPanel.addGlue();
|
||||||
|
@ -11,6 +11,7 @@ import com.skcraft.launcher.swing.LinedBoxPanel;
|
|||||||
import com.skcraft.launcher.swing.MessageLog;
|
import com.skcraft.launcher.swing.MessageLog;
|
||||||
import com.skcraft.launcher.swing.SwingHelper;
|
import com.skcraft.launcher.swing.SwingHelper;
|
||||||
import com.skcraft.launcher.util.PastebinPoster;
|
import com.skcraft.launcher.util.PastebinPoster;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ import java.awt.event.ActionListener;
|
|||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A frame capable of showing messages.
|
* A frame capable of showing messages.
|
||||||
@ -45,7 +46,7 @@ public class ConsoleFrame extends JFrame {
|
|||||||
* @param colorEnabled true to enable a colored console
|
* @param colorEnabled true to enable a colored console
|
||||||
*/
|
*/
|
||||||
public ConsoleFrame(int numLines, boolean colorEnabled) {
|
public ConsoleFrame(int numLines, boolean colorEnabled) {
|
||||||
this(_("console.title"), numLines, colorEnabled);
|
this(SharedLocale.tr("console.title"), numLines, colorEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,7 +80,7 @@ public class ConsoleFrame extends JFrame {
|
|||||||
* Add components to the frame.
|
* Add components to the frame.
|
||||||
*/
|
*/
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
JButton pastebinButton = new JButton(_("console.uploadLog"));
|
JButton pastebinButton = new JButton(SharedLocale.tr("console.uploadLog"));
|
||||||
buttonsPanel = new LinedBoxPanel(true);
|
buttonsPanel = new LinedBoxPanel(true);
|
||||||
|
|
||||||
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
||||||
@ -122,18 +123,18 @@ public class ConsoleFrame extends JFrame {
|
|||||||
private void pastebinLog() {
|
private void pastebinLog() {
|
||||||
String text = messageLog.getPastableText();
|
String text = messageLog.getPastableText();
|
||||||
// Not really bytes!
|
// Not really bytes!
|
||||||
messageLog.log(_("console.pasteUploading", text.length()), messageLog.asHighlighted());
|
messageLog.log(tr("console.pasteUploading", text.length()), messageLog.asHighlighted());
|
||||||
|
|
||||||
PastebinPoster.paste(text, new PastebinPoster.PasteCallback() {
|
PastebinPoster.paste(text, new PastebinPoster.PasteCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void handleSuccess(String url) {
|
public void handleSuccess(String url) {
|
||||||
messageLog.log(_("console.pasteUploaded", url), messageLog.asHighlighted());
|
messageLog.log(tr("console.pasteUploaded", url), messageLog.asHighlighted());
|
||||||
SwingHelper.openURL(url, messageLog);
|
SwingHelper.openURL(url, messageLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleError(String err) {
|
public void handleError(String err) {
|
||||||
messageLog.log(_("console.pasteFailed", err), messageLog.asError());
|
messageLog.log(tr("console.pasteFailed", err), messageLog.asError());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -143,7 +144,7 @@ public class ConsoleFrame extends JFrame {
|
|||||||
if (frame == null) {
|
if (frame == null) {
|
||||||
frame = new ConsoleFrame(10000, false);
|
frame = new ConsoleFrame(10000, false);
|
||||||
globalFrame = frame;
|
globalFrame = frame;
|
||||||
frame.setTitle(_("console.launcherConsoleTitle"));
|
frame.setTitle(SharedLocale.tr("console.launcherConsoleTitle"));
|
||||||
frame.registerLoggerHandler();
|
frame.registerLoggerHandler();
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -8,6 +8,7 @@ package com.skcraft.launcher.dialog;
|
|||||||
|
|
||||||
import com.skcraft.launcher.model.modpack.Feature;
|
import com.skcraft.launcher.model.modpack.Feature;
|
||||||
import com.skcraft.launcher.swing.*;
|
import com.skcraft.launcher.swing.*;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@ -16,27 +17,26 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
import static javax.swing.BorderFactory.createEmptyBorder;
|
import static javax.swing.BorderFactory.createEmptyBorder;
|
||||||
|
|
||||||
public class FeatureSelectionDialog extends JDialog {
|
public class FeatureSelectionDialog extends JDialog {
|
||||||
|
|
||||||
private final List<Feature> features;
|
private final List<Feature> features;
|
||||||
private final JPanel container = new JPanel(new BorderLayout());
|
private final JPanel container = new JPanel(new BorderLayout());
|
||||||
private final JTextArea descText = new JTextArea(_("features.selectForInfo"));
|
private final JTextArea descText = new JTextArea(SharedLocale.tr("features.selectForInfo"));
|
||||||
private final JScrollPane descScroll = new JScrollPane(descText);
|
private final JScrollPane descScroll = new JScrollPane(descText);
|
||||||
private final CheckboxTable componentsTable = new CheckboxTable();
|
private final CheckboxTable componentsTable = new CheckboxTable();
|
||||||
private final JScrollPane componentsScroll = new JScrollPane(componentsTable);
|
private final JScrollPane componentsScroll = new JScrollPane(componentsTable);
|
||||||
private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, componentsScroll, descScroll);
|
private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, componentsScroll, descScroll);
|
||||||
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true);
|
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true);
|
||||||
private final JButton installButton = new JButton(_("features.install"));
|
private final JButton installButton = new JButton(SharedLocale.tr("features.install"));
|
||||||
|
|
||||||
public FeatureSelectionDialog(Window owner, @NonNull List<Feature> features) {
|
public FeatureSelectionDialog(Window owner, @NonNull List<Feature> features) {
|
||||||
super(owner, ModalityType.DOCUMENT_MODAL);
|
super(owner, ModalityType.DOCUMENT_MODAL);
|
||||||
|
|
||||||
this.features = features;
|
this.features = features;
|
||||||
|
|
||||||
setTitle(_("features.title"));
|
setTitle(SharedLocale.tr("features.title"));
|
||||||
initComponents();
|
initComponents();
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
setSize(new Dimension(500, 400));
|
setSize(new Dimension(500, 400));
|
||||||
@ -66,10 +66,10 @@ public class FeatureSelectionDialog extends JDialog {
|
|||||||
buttonsPanel.addGlue();
|
buttonsPanel.addGlue();
|
||||||
buttonsPanel.addElement(installButton);
|
buttonsPanel.addElement(installButton);
|
||||||
|
|
||||||
JLabel descLabel = new JLabel(_("features.intro"));
|
JLabel descLabel = new JLabel(SharedLocale.tr("features.intro"));
|
||||||
descLabel.setBorder(createEmptyBorder(12, 12, 4, 12));
|
descLabel.setBorder(createEmptyBorder(12, 12, 4, 12));
|
||||||
|
|
||||||
SwingHelper.equalWidth(installButton, new JButton(_("button.cancel")));
|
SwingHelper.equalWidth(installButton, new JButton(SharedLocale.tr("button.cancel")));
|
||||||
|
|
||||||
add(descLabel, BorderLayout.NORTH);
|
add(descLabel, BorderLayout.NORTH);
|
||||||
add(container, BorderLayout.CENTER);
|
add(container, BorderLayout.CENTER);
|
||||||
@ -90,7 +90,7 @@ public class FeatureSelectionDialog extends JDialog {
|
|||||||
if (feature != null) {
|
if (feature != null) {
|
||||||
descText.setText(feature.getDescription());
|
descText.setText(feature.getDescription());
|
||||||
} else {
|
} else {
|
||||||
descText.setText(_("features.selectForInfo"));
|
descText.setText(SharedLocale.tr("features.selectForInfo"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import com.skcraft.launcher.swing.*;
|
|||||||
import com.skcraft.launcher.update.HardResetter;
|
import com.skcraft.launcher.update.HardResetter;
|
||||||
import com.skcraft.launcher.update.Remover;
|
import com.skcraft.launcher.update.Remover;
|
||||||
import com.skcraft.launcher.update.Updater;
|
import com.skcraft.launcher.update.Updater;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import com.skcraft.launcher.util.SwingExecutor;
|
import com.skcraft.launcher.util.SwingExecutor;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
@ -42,7 +43,7 @@ import java.util.Date;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
|
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main launcher frame.
|
* The main launcher frame.
|
||||||
@ -60,11 +61,11 @@ public class LauncherFrame extends JFrame {
|
|||||||
private JSplitPane splitPane;
|
private JSplitPane splitPane;
|
||||||
private final JPanel container = new JPanel();
|
private final JPanel container = new JPanel();
|
||||||
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true).fullyPadded();
|
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true).fullyPadded();
|
||||||
private final JButton launchButton = new JButton(_("launcher.launch"));
|
private final JButton launchButton = new JButton(SharedLocale.tr("launcher.launch"));
|
||||||
private final JButton refreshButton = new JButton(_("launcher.checkForUpdates"));
|
private final JButton refreshButton = new JButton(SharedLocale.tr("launcher.checkForUpdates"));
|
||||||
private final JButton optionsButton = new JButton(_("launcher.options"));
|
private final JButton optionsButton = new JButton(SharedLocale.tr("launcher.options"));
|
||||||
private final JButton selfUpdateButton = new JButton(_("launcher.updateLauncher"));
|
private final JButton selfUpdateButton = new JButton(SharedLocale.tr("launcher.updateLauncher"));
|
||||||
private final JCheckBox updateCheck = new JCheckBox(_("launcher.downloadUpdates"));
|
private final JCheckBox updateCheck = new JCheckBox(SharedLocale.tr("launcher.downloadUpdates"));
|
||||||
private URL updateUrl;
|
private URL updateUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +74,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
* @param launcher the launcher
|
* @param launcher the launcher
|
||||||
*/
|
*/
|
||||||
public LauncherFrame(@NonNull Launcher launcher) {
|
public LauncherFrame(@NonNull Launcher launcher) {
|
||||||
super(_("launcher.title", launcher.getVersion()));
|
super(tr("launcher.title", launcher.getVersion()));
|
||||||
|
|
||||||
this.launcher = launcher;
|
this.launcher = launcher;
|
||||||
instancesModel = new InstanceTableModel(launcher.getInstances());
|
instancesModel = new InstanceTableModel(launcher.getInstances());
|
||||||
@ -202,8 +203,8 @@ public class LauncherFrame extends JFrame {
|
|||||||
selfUpdateButton.setVisible(false);
|
selfUpdateButton.setVisible(false);
|
||||||
SwingHelper.showMessageDialog(
|
SwingHelper.showMessageDialog(
|
||||||
LauncherFrame.this,
|
LauncherFrame.this,
|
||||||
_("launcher.selfUpdateComplete"),
|
SharedLocale.tr("launcher.selfUpdateComplete"),
|
||||||
_("launcher.selfUpdateCompleteTitle"),
|
SharedLocale.tr("launcher.selfUpdateCompleteTitle"),
|
||||||
null,
|
null,
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
@ -213,7 +214,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
}
|
}
|
||||||
}, SwingExecutor.INSTANCE);
|
}, SwingExecutor.INSTANCE);
|
||||||
|
|
||||||
ProgressDialog.showProgress(this, future, _("launcher.selfUpdatingTitle"), _("launcher.selfUpdatingStatus"));
|
ProgressDialog.showProgress(this, future, SharedLocale.tr("launcher.selfUpdatingTitle"), SharedLocale.tr("launcher.selfUpdatingStatus"));
|
||||||
SwingHelper.addErrorDialogCallback(this, future);
|
SwingHelper.addErrorDialogCallback(this, future);
|
||||||
} else {
|
} else {
|
||||||
selfUpdateButton.setVisible(false);
|
selfUpdateButton.setVisible(false);
|
||||||
@ -250,27 +251,27 @@ public class LauncherFrame extends JFrame {
|
|||||||
if (selected.isLocal()) {
|
if (selected.isLocal()) {
|
||||||
popup.addSeparator();
|
popup.addSeparator();
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("instance.openFolder"));
|
menuItem = new JMenuItem(SharedLocale.tr("instance.openFolder"));
|
||||||
menuItem.addActionListener(ActionListeners.browseDir(
|
menuItem.addActionListener(ActionListeners.browseDir(
|
||||||
LauncherFrame.this, selected.getContentDir(), true));
|
LauncherFrame.this, selected.getContentDir(), true));
|
||||||
popup.add(menuItem);
|
popup.add(menuItem);
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("instance.openSaves"));
|
menuItem = new JMenuItem(SharedLocale.tr("instance.openSaves"));
|
||||||
menuItem.addActionListener(ActionListeners.browseDir(
|
menuItem.addActionListener(ActionListeners.browseDir(
|
||||||
LauncherFrame.this, new File(selected.getContentDir(), "saves"), true));
|
LauncherFrame.this, new File(selected.getContentDir(), "saves"), true));
|
||||||
popup.add(menuItem);
|
popup.add(menuItem);
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("instance.openResourcePacks"));
|
menuItem = new JMenuItem(SharedLocale.tr("instance.openResourcePacks"));
|
||||||
menuItem.addActionListener(ActionListeners.browseDir(
|
menuItem.addActionListener(ActionListeners.browseDir(
|
||||||
LauncherFrame.this, new File(selected.getContentDir(), "resourcepacks"), true));
|
LauncherFrame.this, new File(selected.getContentDir(), "resourcepacks"), true));
|
||||||
popup.add(menuItem);
|
popup.add(menuItem);
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("instance.openScreenshots"));
|
menuItem = new JMenuItem(SharedLocale.tr("instance.openScreenshots"));
|
||||||
menuItem.addActionListener(ActionListeners.browseDir(
|
menuItem.addActionListener(ActionListeners.browseDir(
|
||||||
LauncherFrame.this, new File(selected.getContentDir(), "screenshots"), true));
|
LauncherFrame.this, new File(selected.getContentDir(), "screenshots"), true));
|
||||||
popup.add(menuItem);
|
popup.add(menuItem);
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("instance.copyAsPath"));
|
menuItem = new JMenuItem(SharedLocale.tr("instance.copyAsPath"));
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -284,7 +285,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
popup.addSeparator();
|
popup.addSeparator();
|
||||||
|
|
||||||
if (!selected.isUpdatePending()) {
|
if (!selected.isUpdatePending()) {
|
||||||
menuItem = new JMenuItem(_("instance.forceUpdate"));
|
menuItem = new JMenuItem(SharedLocale.tr("instance.forceUpdate"));
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -296,7 +297,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
popup.add(menuItem);
|
popup.add(menuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("instance.hardForceUpdate"));
|
menuItem = new JMenuItem(SharedLocale.tr("instance.hardForceUpdate"));
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -305,7 +306,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
});
|
});
|
||||||
popup.add(menuItem);
|
popup.add(menuItem);
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("instance.deleteFiles"));
|
menuItem = new JMenuItem(SharedLocale.tr("instance.deleteFiles"));
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -318,7 +319,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
popup.addSeparator();
|
popup.addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("launcher.refreshList"));
|
menuItem = new JMenuItem(SharedLocale.tr("launcher.refreshList"));
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -333,7 +334,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
|
|
||||||
private void confirmDelete(Instance instance) {
|
private void confirmDelete(Instance instance) {
|
||||||
if (!SwingHelper.confirmDialog(this,
|
if (!SwingHelper.confirmDialog(this,
|
||||||
_("instance.confirmDelete", instance.getTitle()), _("confirmTitle"))) {
|
tr("instance.confirmDelete", instance.getTitle()), SharedLocale.tr("confirmTitle"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +345,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
|
|
||||||
// Show progress
|
// Show progress
|
||||||
ProgressDialog.showProgress(
|
ProgressDialog.showProgress(
|
||||||
this, future, _("instance.deletingTitle"), _("instance.deletingStatus", instance.getTitle()));
|
this, future, SharedLocale.tr("instance.deletingTitle"), tr("instance.deletingStatus", instance.getTitle()));
|
||||||
SwingHelper.addErrorDialogCallback(this, future);
|
SwingHelper.addErrorDialogCallback(this, future);
|
||||||
|
|
||||||
// Update the list of instances after updating
|
// Update the list of instances after updating
|
||||||
@ -357,7 +358,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void confirmHardUpdate(Instance instance) {
|
private void confirmHardUpdate(Instance instance) {
|
||||||
if (!SwingHelper.confirmDialog(this, _("instance.confirmHardUpdate"), _("confirmTitle"))) {
|
if (!SwingHelper.confirmDialog(this, SharedLocale.tr("instance.confirmHardUpdate"), SharedLocale.tr("confirmTitle"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,8 +368,8 @@ public class LauncherFrame extends JFrame {
|
|||||||
launcher.getExecutor().submit(resetter), resetter);
|
launcher.getExecutor().submit(resetter), resetter);
|
||||||
|
|
||||||
// Show progress
|
// Show progress
|
||||||
ProgressDialog.showProgress( this, future, _("instance.resettingTitle"),
|
ProgressDialog.showProgress( this, future, SharedLocale.tr("instance.resettingTitle"),
|
||||||
_("instance.resettingStatus", instance.getTitle()));
|
tr("instance.resettingStatus", instance.getTitle()));
|
||||||
SwingHelper.addErrorDialogCallback(this, future);
|
SwingHelper.addErrorDialogCallback(this, future);
|
||||||
|
|
||||||
// Update the list of instances after updating
|
// Update the list of instances after updating
|
||||||
@ -397,7 +398,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
}
|
}
|
||||||
}, SwingExecutor.INSTANCE);
|
}, SwingExecutor.INSTANCE);
|
||||||
|
|
||||||
ProgressDialog.showProgress(this, future, _("launcher.checkingTitle"), _("launcher.checkingStatus"));
|
ProgressDialog.showProgress(this, future, SharedLocale.tr("launcher.checkingTitle"), SharedLocale.tr("launcher.checkingStatus"));
|
||||||
SwingHelper.addErrorDialogCallback(this, future);
|
SwingHelper.addErrorDialogCallback(this, future);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,7 +437,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
|
|
||||||
// Show progress
|
// Show progress
|
||||||
ProgressDialog.showProgress(
|
ProgressDialog.showProgress(
|
||||||
this, future, _("launcher.updatingTitle"), _("launcher.updatingStatus", instance.getTitle()));
|
this, future, SharedLocale.tr("launcher.updatingTitle"), tr("launcher.updatingStatus", instance.getTitle()));
|
||||||
SwingHelper.addErrorDialogCallback(this, future);
|
SwingHelper.addErrorDialogCallback(this, future);
|
||||||
|
|
||||||
// Update the list of instances after updating
|
// Update the list of instances after updating
|
||||||
@ -462,7 +463,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
launch(instance, session);
|
launch(instance, session);
|
||||||
}
|
}
|
||||||
} catch (ArrayIndexOutOfBoundsException e) {
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
SwingHelper.showErrorDialog(this, _("launcher.noInstanceError"), _("launcher.noInstanceTitle"));
|
SwingHelper.showErrorDialog(this, SharedLocale.tr("launcher.noInstanceError"), SharedLocale.tr("launcher.noInstanceTitle"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,7 +477,7 @@ public class LauncherFrame extends JFrame {
|
|||||||
|
|
||||||
// Show process for the process retrieval
|
// Show process for the process retrieval
|
||||||
ProgressDialog.showProgress(
|
ProgressDialog.showProgress(
|
||||||
this, processFuture, _("launcher.launchingTItle"), _("launcher.launchingStatus", instance.getTitle()));
|
this, processFuture, SharedLocale.tr("launcher.launchingTItle"), tr("launcher.launchingStatus", instance.getTitle()));
|
||||||
|
|
||||||
// If the process is started, get rid of this window
|
// If the process is started, get rid of this window
|
||||||
Futures.addCallback(processFuture, new FutureCallback<Process>() {
|
Futures.addCallback(processFuture, new FutureCallback<Process>() {
|
||||||
|
@ -16,6 +16,7 @@ import com.skcraft.launcher.Launcher;
|
|||||||
import com.skcraft.launcher.auth.*;
|
import com.skcraft.launcher.auth.*;
|
||||||
import com.skcraft.launcher.swing.*;
|
import com.skcraft.launcher.swing.*;
|
||||||
import com.skcraft.launcher.persistence.Persistence;
|
import com.skcraft.launcher.persistence.Persistence;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import com.skcraft.launcher.util.SwingExecutor;
|
import com.skcraft.launcher.util.SwingExecutor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
@ -28,8 +29,6 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The login dialog.
|
* The login dialog.
|
||||||
*/
|
*/
|
||||||
@ -41,12 +40,12 @@ public class LoginDialog extends JDialog {
|
|||||||
|
|
||||||
private final JComboBox idCombo = new JComboBox();
|
private final JComboBox idCombo = new JComboBox();
|
||||||
private final JPasswordField passwordText = new JPasswordField();
|
private final JPasswordField passwordText = new JPasswordField();
|
||||||
private final JCheckBox rememberIdCheck = new JCheckBox(_("login.rememberId"));
|
private final JCheckBox rememberIdCheck = new JCheckBox(SharedLocale.tr("login.rememberId"));
|
||||||
private final JCheckBox rememberPassCheck = new JCheckBox(_("login.rememberPassword"));
|
private final JCheckBox rememberPassCheck = new JCheckBox(SharedLocale.tr("login.rememberPassword"));
|
||||||
private final JButton loginButton = new JButton(_("login.login"));
|
private final JButton loginButton = new JButton(SharedLocale.tr("login.login"));
|
||||||
private final LinkButton recoverButton = new LinkButton(_("login.recoverAccount"));
|
private final LinkButton recoverButton = new LinkButton(SharedLocale.tr("login.recoverAccount"));
|
||||||
private final JButton offlineButton = new JButton(_("login.playOffline"));
|
private final JButton offlineButton = new JButton(SharedLocale.tr("login.playOffline"));
|
||||||
private final JButton cancelButton = new JButton(_("button.cancel"));
|
private final JButton cancelButton = new JButton(SharedLocale.tr("button.cancel"));
|
||||||
private final FormPanel formPanel = new FormPanel();
|
private final FormPanel formPanel = new FormPanel();
|
||||||
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true);
|
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true);
|
||||||
|
|
||||||
@ -62,7 +61,7 @@ public class LoginDialog extends JDialog {
|
|||||||
this.launcher = launcher;
|
this.launcher = launcher;
|
||||||
this.accounts = launcher.getAccounts();
|
this.accounts = launcher.getAccounts();
|
||||||
|
|
||||||
setTitle(_("login.title"));
|
setTitle(SharedLocale.tr("login.title"));
|
||||||
initComponents();
|
initComponents();
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
setMinimumSize(new Dimension(420, 0));
|
setMinimumSize(new Dimension(420, 0));
|
||||||
@ -95,8 +94,8 @@ public class LoginDialog extends JDialog {
|
|||||||
|
|
||||||
loginButton.setFont(loginButton.getFont().deriveFont(Font.BOLD));
|
loginButton.setFont(loginButton.getFont().deriveFont(Font.BOLD));
|
||||||
|
|
||||||
formPanel.addRow(new JLabel(_("login.idEmail")), idCombo);
|
formPanel.addRow(new JLabel(SharedLocale.tr("login.idEmail")), idCombo);
|
||||||
formPanel.addRow(new JLabel(_("login.password")), passwordText);
|
formPanel.addRow(new JLabel(SharedLocale.tr("login.password")), passwordText);
|
||||||
formPanel.addRow(new JLabel(), rememberIdCheck);
|
formPanel.addRow(new JLabel(), rememberIdCheck);
|
||||||
formPanel.addRow(new JLabel(), rememberPassCheck);
|
formPanel.addRow(new JLabel(), rememberPassCheck);
|
||||||
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(26, 13, 13, 13));
|
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(26, 13, 13, 13));
|
||||||
@ -185,7 +184,7 @@ public class LoginDialog extends JDialog {
|
|||||||
if (selected != null && selected instanceof Account) {
|
if (selected != null && selected instanceof Account) {
|
||||||
final Account account = (Account) selected;
|
final Account account = (Account) selected;
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("login.forgetUser"));
|
menuItem = new JMenuItem(SharedLocale.tr("login.forgetUser"));
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -196,7 +195,7 @@ public class LoginDialog extends JDialog {
|
|||||||
popup.add(menuItem);
|
popup.add(menuItem);
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(account.getPassword())) {
|
if (!Strings.isNullOrEmpty(account.getPassword())) {
|
||||||
menuItem = new JMenuItem(_("login.forgetPassword"));
|
menuItem = new JMenuItem(SharedLocale.tr("login.forgetPassword"));
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -208,13 +207,13 @@ public class LoginDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menuItem = new JMenuItem(_("login.forgetAllPasswords"));
|
menuItem = new JMenuItem(SharedLocale.tr("login.forgetAllPasswords"));
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (SwingHelper.confirmDialog(LoginDialog.this,
|
if (SwingHelper.confirmDialog(LoginDialog.this,
|
||||||
_("login.confirmForgetAllPasswords"),
|
SharedLocale.tr("login.confirmForgetAllPasswords"),
|
||||||
_("login.forgetAllPasswordsTitle"))) {
|
SharedLocale.tr("login.forgetAllPasswordsTitle"))) {
|
||||||
accounts.forgetPasswords();
|
accounts.forgetPasswords();
|
||||||
Persistence.commitAndForget(accounts);
|
Persistence.commitAndForget(accounts);
|
||||||
}
|
}
|
||||||
@ -255,7 +254,7 @@ public class LoginDialog extends JDialog {
|
|||||||
String password = passwordText.getText();
|
String password = passwordText.getText();
|
||||||
|
|
||||||
if (password == null || password.isEmpty()) {
|
if (password == null || password.isEmpty()) {
|
||||||
SwingHelper.showErrorDialog(this, _("login.noPasswordError"), _("login.noPasswordTitle"));
|
SwingHelper.showErrorDialog(this, SharedLocale.tr("login.noPasswordError"), SharedLocale.tr("login.noPasswordTitle"));
|
||||||
} else {
|
} else {
|
||||||
if (rememberPassCheck.isSelected()) {
|
if (rememberPassCheck.isSelected()) {
|
||||||
account.setPassword(password);
|
account.setPassword(password);
|
||||||
@ -276,7 +275,7 @@ public class LoginDialog extends JDialog {
|
|||||||
attemptLogin(account, password);
|
attemptLogin(account, password);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SwingHelper.showErrorDialog(this, _("login.noLoginError"), _("login.noLoginTitle"));
|
SwingHelper.showErrorDialog(this, SharedLocale.tr("login.noLoginError"), SharedLocale.tr("login.noLoginTitle"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +295,7 @@ public class LoginDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
}, SwingExecutor.INSTANCE);
|
}, SwingExecutor.INSTANCE);
|
||||||
|
|
||||||
ProgressDialog.showProgress(this, future, _("login.loggingInTitle"), _("login.loggingInStatus"));
|
ProgressDialog.showProgress(this, future, SharedLocale.tr("login.loggingInTitle"), SharedLocale.tr("login.loggingInStatus"));
|
||||||
SwingHelper.addErrorDialogCallback(this, future);
|
SwingHelper.addErrorDialogCallback(this, future);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +338,7 @@ public class LoginDialog extends JDialog {
|
|||||||
Persistence.commitAndForget(getAccounts());
|
Persistence.commitAndForget(getAccounts());
|
||||||
return identities.get(0);
|
return identities.get(0);
|
||||||
} else {
|
} else {
|
||||||
throw new AuthenticationException("Minecraft not owned", _("login.minecraftNotOwnedError"));
|
throw new AuthenticationException("Minecraft not owned", SharedLocale.tr("login.minecraftNotOwnedError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,7 +349,7 @@ public class LoginDialog extends JDialog {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return _("login.loggingInStatus");
|
return SharedLocale.tr("login.loggingInStatus");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ package com.skcraft.launcher.dialog;
|
|||||||
|
|
||||||
import com.skcraft.launcher.swing.LinedBoxPanel;
|
import com.skcraft.launcher.swing.LinedBoxPanel;
|
||||||
import com.skcraft.launcher.swing.SwingHelper;
|
import com.skcraft.launcher.swing.SwingHelper;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A version of the console window that can manage a process.
|
* A version of the console window that can manage a process.
|
||||||
@ -40,7 +41,7 @@ public class ProcessConsoleFrame extends ConsoleFrame {
|
|||||||
* @param colorEnabled whether color is enabled in the log
|
* @param colorEnabled whether color is enabled in the log
|
||||||
*/
|
*/
|
||||||
public ProcessConsoleFrame(int numLines, boolean colorEnabled) {
|
public ProcessConsoleFrame(int numLines, boolean colorEnabled) {
|
||||||
super(_("console.title"), numLines, colorEnabled);
|
super(SharedLocale.tr("console.title"), numLines, colorEnabled);
|
||||||
processOut = new PrintWriter(
|
processOut = new PrintWriter(
|
||||||
getMessageLog().getOutputStream(new Color(0, 0, 255)), true);
|
getMessageLog().getOutputStream(new Color(0, 0, 255)), true);
|
||||||
initComponents();
|
initComponents();
|
||||||
@ -56,13 +57,13 @@ public class ProcessConsoleFrame extends ConsoleFrame {
|
|||||||
try {
|
try {
|
||||||
Process lastProcess = this.process;
|
Process lastProcess = this.process;
|
||||||
if (lastProcess != null) {
|
if (lastProcess != null) {
|
||||||
processOut.println(_("console.processEndCode", lastProcess.exitValue()));
|
processOut.println(tr("console.processEndCode", lastProcess.exitValue()));
|
||||||
}
|
}
|
||||||
} catch (IllegalThreadStateException e) {
|
} catch (IllegalThreadStateException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process != null) {
|
if (process != null) {
|
||||||
processOut.println(_("console.attachedToProcess"));
|
processOut.println(SharedLocale.tr("console.attachedToProcess"));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.process = process;
|
this.process = process;
|
||||||
@ -109,7 +110,7 @@ public class ProcessConsoleFrame extends ConsoleFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void initComponents() {
|
protected void initComponents() {
|
||||||
killButton = new JButton(_("console.forceClose"));
|
killButton = new JButton(SharedLocale.tr("console.forceClose"));
|
||||||
minimizeButton = new JButton(); // Text set later
|
minimizeButton = new JButton(); // Text set later
|
||||||
|
|
||||||
LinedBoxPanel buttonsPanel = getButtonsPanel();
|
LinedBoxPanel buttonsPanel = getButtonsPanel();
|
||||||
@ -143,7 +144,7 @@ public class ProcessConsoleFrame extends ConsoleFrame {
|
|||||||
|
|
||||||
trayIcon = new TrayIcon(getTrayRunningIcon());
|
trayIcon = new TrayIcon(getTrayRunningIcon());
|
||||||
trayIcon.setImageAutoSize(true);
|
trayIcon.setImageAutoSize(true);
|
||||||
trayIcon.setToolTip(_("console.trayTooltip"));
|
trayIcon.setToolTip(SharedLocale.tr("console.trayTooltip"));
|
||||||
|
|
||||||
trayIcon.addActionListener(new ActionListener() {
|
trayIcon.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -155,10 +156,10 @@ public class ProcessConsoleFrame extends ConsoleFrame {
|
|||||||
PopupMenu popup = new PopupMenu();
|
PopupMenu popup = new PopupMenu();
|
||||||
MenuItem item;
|
MenuItem item;
|
||||||
|
|
||||||
popup.add(item = new MenuItem(_("console.trayTitle")));
|
popup.add(item = new MenuItem(SharedLocale.tr("console.trayTitle")));
|
||||||
item.setEnabled(false);
|
item.setEnabled(false);
|
||||||
|
|
||||||
popup.add(item = new MenuItem(_("console.tray.showWindow")));
|
popup.add(item = new MenuItem(SharedLocale.tr("console.tray.showWindow")));
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -166,7 +167,7 @@ public class ProcessConsoleFrame extends ConsoleFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
popup.add(item = new MenuItem(_("console.tray.forceClose")));
|
popup.add(item = new MenuItem(SharedLocale.tr("console.tray.forceClose")));
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -192,9 +193,9 @@ public class ProcessConsoleFrame extends ConsoleFrame {
|
|||||||
killButton.setEnabled(hasProcess());
|
killButton.setEnabled(hasProcess());
|
||||||
|
|
||||||
if (!hasProcess() || trayIcon == null) {
|
if (!hasProcess() || trayIcon == null) {
|
||||||
minimizeButton.setText(_("console.closeWindow"));
|
minimizeButton.setText(SharedLocale.tr("console.closeWindow"));
|
||||||
} else {
|
} else {
|
||||||
minimizeButton.setText(_("console.hideWindow"));
|
minimizeButton.setText(SharedLocale.tr("console.hideWindow"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trayIcon != null) {
|
if (trayIcon != null) {
|
||||||
@ -215,7 +216,7 @@ public class ProcessConsoleFrame extends ConsoleFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean confirmKill() {
|
private boolean confirmKill() {
|
||||||
return SwingHelper.confirmDialog(this, _("console.confirmKill"), _("console.confirmKillTitle"));
|
return SwingHelper.confirmDialog(this, SharedLocale.tr("console.confirmKill"), SharedLocale.tr("console.confirmKillTitle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void minimize() {
|
private void minimize() {
|
||||||
|
@ -12,6 +12,7 @@ import com.skcraft.concurrency.ObservableFuture;
|
|||||||
import com.skcraft.concurrency.ProgressObservable;
|
import com.skcraft.concurrency.ProgressObservable;
|
||||||
import com.skcraft.launcher.swing.LinedBoxPanel;
|
import com.skcraft.launcher.swing.LinedBoxPanel;
|
||||||
import com.skcraft.launcher.swing.SwingHelper;
|
import com.skcraft.launcher.swing.SwingHelper;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import com.skcraft.launcher.util.SwingExecutor;
|
import com.skcraft.launcher.util.SwingExecutor;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ import java.lang.ref.WeakReference;
|
|||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
@Log
|
@Log
|
||||||
public class ProgressDialog extends JDialog {
|
public class ProgressDialog extends JDialog {
|
||||||
@ -42,8 +43,8 @@ public class ProgressDialog extends JDialog {
|
|||||||
private final JTextArea logText = new JTextArea();
|
private final JTextArea logText = new JTextArea();
|
||||||
private final JScrollPane logScroll = new JScrollPane(logText);
|
private final JScrollPane logScroll = new JScrollPane(logText);
|
||||||
private final JButton detailsButton = new JButton();
|
private final JButton detailsButton = new JButton();
|
||||||
private final JButton logButton = new JButton(_("progress.viewLog"));
|
private final JButton logButton = new JButton(SharedLocale.tr("progress.viewLog"));
|
||||||
private final JButton cancelButton = new JButton(_("button.cancel"));
|
private final JButton cancelButton = new JButton(SharedLocale.tr("button.cancel"));
|
||||||
|
|
||||||
public ProgressDialog(Window owner, String title, String message) {
|
public ProgressDialog(Window owner, String title, String message) {
|
||||||
super(owner, title, ModalityType.DOCUMENT_MODAL);
|
super(owner, title, ModalityType.DOCUMENT_MODAL);
|
||||||
@ -69,14 +70,14 @@ public class ProgressDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setCompactSize() {
|
private void setCompactSize() {
|
||||||
detailsButton.setText(_("progress.details"));
|
detailsButton.setText(SharedLocale.tr("progress.details"));
|
||||||
logButton.setVisible(false);
|
logButton.setVisible(false);
|
||||||
setMinimumSize(new Dimension(400, 100));
|
setMinimumSize(new Dimension(400, 100));
|
||||||
pack();
|
pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDetailsSize() {
|
private void setDetailsSize() {
|
||||||
detailsButton.setText(_("progress.less"));
|
detailsButton.setText(SharedLocale.tr("progress.less"));
|
||||||
logButton.setVisible(true);
|
logButton.setVisible(true);
|
||||||
setSize(400, 350);
|
setSize(400, 350);
|
||||||
}
|
}
|
||||||
@ -137,7 +138,7 @@ public class ProgressDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean confirmCancel() {
|
private boolean confirmCancel() {
|
||||||
return SwingHelper.confirmDialog(this, _("progress.confirmCancel"), _("progress.confirmCancelTitle"));
|
return SwingHelper.confirmDialog(this, SharedLocale.tr("progress.confirmCancel"), SharedLocale.tr("progress.confirmCancelTitle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void cancel() {
|
protected void cancel() {
|
||||||
@ -213,7 +214,7 @@ public class ProgressDialog extends JDialog {
|
|||||||
|
|
||||||
double progress = observable.getProgress();
|
double progress = observable.getProgress();
|
||||||
if (progress >= 0) {
|
if (progress >= 0) {
|
||||||
dialog.setTitle(_("progress.percentTitle",
|
dialog.setTitle(tr("progress.percentTitle",
|
||||||
Math.round(progress * 100 * 100) / 100.0, dialog.defaultTitle));
|
Math.round(progress * 100 * 100) / 100.0, dialog.defaultTitle));
|
||||||
progressBar.setValue((int) (progress * 1000));
|
progressBar.setValue((int) (progress * 1000));
|
||||||
progressBar.setIndeterminate(false);
|
progressBar.setIndeterminate(false);
|
||||||
@ -224,7 +225,7 @@ public class ProgressDialog extends JDialog {
|
|||||||
|
|
||||||
String status = observable.getStatus();
|
String status = observable.getStatus();
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
status = _("progress.defaultStatus");
|
status = SharedLocale.tr("progress.defaultStatus");
|
||||||
label.setText(dialog.defaultMessage);
|
label.setText(dialog.defaultMessage);
|
||||||
} else {
|
} else {
|
||||||
int index = status.indexOf('\n');
|
int index = status.indexOf('\n');
|
||||||
|
@ -14,7 +14,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
@Log
|
@Log
|
||||||
public class FileCopy implements InstallTask {
|
public class FileCopy implements InstallTask {
|
||||||
@ -41,7 +41,7 @@ public class FileCopy implements InstallTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return _("installer.copyingFile", from, to);
|
return tr("installer.copyingFile", from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
@Log
|
@Log
|
||||||
public class FileMover implements InstallTask {
|
public class FileMover implements InstallTask {
|
||||||
@ -41,7 +41,7 @@ public class FileMover implements InstallTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return _("installer.movingFile", from, to);
|
return tr("installer.movingFile", from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import com.google.common.util.concurrent.ListeningExecutorService;
|
|||||||
import com.google.common.util.concurrent.MoreExecutors;
|
import com.google.common.util.concurrent.MoreExecutors;
|
||||||
import com.skcraft.concurrency.ProgressObservable;
|
import com.skcraft.concurrency.ProgressObservable;
|
||||||
import com.skcraft.launcher.util.HttpRequest;
|
import com.skcraft.launcher.util.HttpRequest;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -29,7 +30,7 @@ import java.util.concurrent.ExecutionException;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
@Log
|
@Log
|
||||||
public class HttpDownloader implements Downloader {
|
public class HttpDownloader implements Downloader {
|
||||||
@ -158,9 +159,9 @@ public class HttpDownloader implements Downloader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized String getStatus() {
|
public synchronized String getStatus() {
|
||||||
String failMessage = _("downloader.failedCount", failed.size());
|
String failMessage = tr("downloader.failedCount", failed.size());
|
||||||
if (running.size() == 1) {
|
if (running.size() == 1) {
|
||||||
return _("downloader.downloadingItem", running.get(0).getName()) +
|
return tr("downloader.downloadingItem", running.get(0).getName()) +
|
||||||
"\n" + running.get(0).getStatus() +
|
"\n" + running.get(0).getStatus() +
|
||||||
"\n" + failMessage;
|
"\n" + failMessage;
|
||||||
} else if (running.size() > 0) {
|
} else if (running.size() > 0) {
|
||||||
@ -169,11 +170,11 @@ public class HttpDownloader implements Downloader {
|
|||||||
builder.append("\n");
|
builder.append("\n");
|
||||||
builder.append(job.getStatus());
|
builder.append(job.getStatus());
|
||||||
}
|
}
|
||||||
return _("downloader.downloadingList", queue.size(), left, failed.size()) +
|
return tr("downloader.downloadingList", queue.size(), left, failed.size()) +
|
||||||
builder.toString() +
|
builder.toString() +
|
||||||
"\n" + failMessage;
|
"\n" + failMessage;
|
||||||
} else {
|
} else {
|
||||||
return _("downloader.noDownloads");
|
return SharedLocale.tr("downloader.noDownloads");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,9 +271,9 @@ public class HttpDownloader implements Downloader {
|
|||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
double progress = getProgress();
|
double progress = getProgress();
|
||||||
if (progress >= 0) {
|
if (progress >= 0) {
|
||||||
return _("downloader.jobProgress", name, Math.round(progress * 100 * 100) / 100.0);
|
return tr("downloader.jobProgress", name, Math.round(progress * 100 * 100) / 100.0);
|
||||||
} else {
|
} else {
|
||||||
return _("downloader.jobPending", name);
|
return tr("downloader.jobPending", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
@Log
|
@Log
|
||||||
public class InstallLogFileMover implements InstallTask {
|
public class InstallLogFileMover implements InstallTask {
|
||||||
@ -44,7 +44,7 @@ public class InstallLogFileMover implements InstallTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return _("installer.movingFile", from, to);
|
return tr("installer.movingFile", from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
package com.skcraft.launcher.install;
|
package com.skcraft.launcher.install;
|
||||||
|
|
||||||
import com.skcraft.concurrency.ProgressObservable;
|
import com.skcraft.concurrency.ProgressObservable;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
@ -18,7 +19,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.skcraft.launcher.LauncherUtils.checkInterrupted;
|
import static com.skcraft.launcher.LauncherUtils.checkInterrupted;
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
@Log
|
@Log
|
||||||
public class Installer implements ProgressObservable {
|
public class Installer implements ProgressObservable {
|
||||||
@ -77,9 +78,9 @@ public class Installer implements ProgressObservable {
|
|||||||
if (status == null) {
|
if (status == null) {
|
||||||
status = running.toString();
|
status = running.toString();
|
||||||
}
|
}
|
||||||
return _("installer.executing", count - finished) + "\n" + status;
|
return tr("installer.executing", count - finished) + "\n" + status;
|
||||||
} else {
|
} else {
|
||||||
return _("installer.installing");
|
return SharedLocale.tr("installer.installing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import com.skcraft.launcher.model.minecraft.VersionManifest;
|
|||||||
import com.skcraft.launcher.persistence.Persistence;
|
import com.skcraft.launcher.persistence.Persistence;
|
||||||
import com.skcraft.launcher.util.Environment;
|
import com.skcraft.launcher.util.Environment;
|
||||||
import com.skcraft.launcher.util.Platform;
|
import com.skcraft.launcher.util.Platform;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -36,7 +37,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import static com.skcraft.launcher.LauncherUtils.checkInterrupted;
|
import static com.skcraft.launcher.LauncherUtils.checkInterrupted;
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the launching of an instance.
|
* Handles the launching of an instance.
|
||||||
@ -44,7 +45,7 @@ import static com.skcraft.launcher.util.SharedLocale._;
|
|||||||
@Log
|
@Log
|
||||||
public class Runner implements Callable<Process>, ProgressObservable {
|
public class Runner implements Callable<Process>, ProgressObservable {
|
||||||
|
|
||||||
private ProgressObservable progress = new DefaultProgress(0, _("runner.preparing"));
|
private ProgressObservable progress = new DefaultProgress(0, SharedLocale.tr("runner.preparing"));
|
||||||
|
|
||||||
private final ObjectMapper mapper = new ObjectMapper();
|
private final ObjectMapper mapper = new ObjectMapper();
|
||||||
private final Launcher launcher;
|
private final Launcher launcher;
|
||||||
@ -92,7 +93,7 @@ public class Runner implements Callable<Process>, ProgressObservable {
|
|||||||
@Override
|
@Override
|
||||||
public Process call() throws Exception {
|
public Process call() throws Exception {
|
||||||
if (!instance.isInstalled()) {
|
if (!instance.isInstalled()) {
|
||||||
throw new LauncherException("Update required", _("runner.updateRequired"));
|
throw new LauncherException("Update required", SharedLocale.tr("runner.updateRequired"));
|
||||||
}
|
}
|
||||||
|
|
||||||
config = launcher.getConfig();
|
config = launcher.getConfig();
|
||||||
@ -110,12 +111,12 @@ public class Runner implements Callable<Process>, ProgressObservable {
|
|||||||
instance.setInstalled(false);
|
instance.setInstalled(false);
|
||||||
Persistence.commitAndForget(instance);
|
Persistence.commitAndForget(instance);
|
||||||
throw new LauncherException("Missing assets index " + assetsFile.getAbsolutePath(),
|
throw new LauncherException("Missing assets index " + assetsFile.getAbsolutePath(),
|
||||||
_("runner.missingAssetsIndex", instance.getTitle(), assetsFile.getAbsolutePath()));
|
tr("runner.missingAssetsIndex", instance.getTitle(), assetsFile.getAbsolutePath()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
instance.setInstalled(false);
|
instance.setInstalled(false);
|
||||||
Persistence.commitAndForget(instance);
|
Persistence.commitAndForget(instance);
|
||||||
throw new LauncherException("Corrupt assets index " + assetsFile.getAbsolutePath(),
|
throw new LauncherException("Corrupt assets index " + assetsFile.getAbsolutePath(),
|
||||||
_("runner.corruptAssetsIndex", instance.getTitle(), assetsFile.getAbsolutePath()));
|
tr("runner.corruptAssetsIndex", instance.getTitle(), assetsFile.getAbsolutePath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy over assets to the tree
|
// Copy over assets to the tree
|
||||||
@ -129,7 +130,7 @@ public class Runner implements Callable<Process>, ProgressObservable {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress = new DefaultProgress(0.9, _("runner.collectingArgs"));
|
progress = new DefaultProgress(0.9, SharedLocale.tr("runner.collectingArgs"));
|
||||||
|
|
||||||
addJvmArgs();
|
addJvmArgs();
|
||||||
addLibraries();
|
addLibraries();
|
||||||
@ -148,7 +149,7 @@ public class Runner implements Callable<Process>, ProgressObservable {
|
|||||||
Runner.log.info("Launching: " + builder);
|
Runner.log.info("Launching: " + builder);
|
||||||
checkInterrupted();
|
checkInterrupted();
|
||||||
|
|
||||||
progress = new DefaultProgress(1, _("runner.startingJava"));
|
progress = new DefaultProgress(1, SharedLocale.tr("runner.startingJava"));
|
||||||
|
|
||||||
return processBuilder.start();
|
return processBuilder.start();
|
||||||
}
|
}
|
||||||
@ -204,7 +205,7 @@ public class Runner implements Callable<Process>, ProgressObservable {
|
|||||||
instance.setInstalled(false);
|
instance.setInstalled(false);
|
||||||
Persistence.commitAndForget(instance);
|
Persistence.commitAndForget(instance);
|
||||||
throw new LauncherException("Missing library " + library.getName(),
|
throw new LauncherException("Missing library " + library.getName(),
|
||||||
_("runner.missingLibrary", instance.getTitle(), library.getName()));
|
tr("runner.missingLibrary", instance.getTitle(), library.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import com.skcraft.concurrency.ProgressObservable;
|
|||||||
import com.skcraft.launcher.Launcher;
|
import com.skcraft.launcher.Launcher;
|
||||||
import com.skcraft.launcher.install.FileMover;
|
import com.skcraft.launcher.install.FileMover;
|
||||||
import com.skcraft.launcher.install.Installer;
|
import com.skcraft.launcher.install.Installer;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -19,8 +20,6 @@ import java.util.concurrent.Callable;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
public class SelfUpdater implements Callable<File>, ProgressObservable {
|
public class SelfUpdater implements Callable<File>, ProgressObservable {
|
||||||
|
|
||||||
public static boolean updatedAlready = false;
|
public static boolean updatedAlready = false;
|
||||||
@ -28,7 +27,7 @@ public class SelfUpdater implements Callable<File>, ProgressObservable {
|
|||||||
private final Launcher launcher;
|
private final Launcher launcher;
|
||||||
private final URL url;
|
private final URL url;
|
||||||
private final Installer installer;
|
private final Installer installer;
|
||||||
private ProgressObservable progress = new DefaultProgress(0, _("updater.updating"));
|
private ProgressObservable progress = new DefaultProgress(0, SharedLocale.tr("updater.updating"));
|
||||||
|
|
||||||
public SelfUpdater(@NonNull Launcher launcher, @NonNull URL url) {
|
public SelfUpdater(@NonNull Launcher launcher, @NonNull URL url) {
|
||||||
this.launcher = launcher;
|
this.launcher = launcher;
|
||||||
|
@ -9,14 +9,13 @@ package com.skcraft.launcher.selfupdate;
|
|||||||
import com.skcraft.launcher.Launcher;
|
import com.skcraft.launcher.Launcher;
|
||||||
import com.skcraft.launcher.LauncherException;
|
import com.skcraft.launcher.LauncherException;
|
||||||
import com.skcraft.launcher.util.HttpRequest;
|
import com.skcraft.launcher.util.HttpRequest;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A worker that checks for an update to the launcher. A URL is returned
|
* A worker that checks for an update to the launcher. A URL is returned
|
||||||
* if there is an update to be downloaded.
|
* if there is an update to be downloaded.
|
||||||
@ -56,7 +55,7 @@ public class UpdateChecker implements Callable<URL> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new LauncherException(e, _("errors.selfUpdateCheckError"));
|
throw new LauncherException(e, SharedLocale.tr("errors.selfUpdateCheckError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,12 +7,11 @@
|
|||||||
package com.skcraft.launcher.swing;
|
package com.skcraft.launcher.swing;
|
||||||
|
|
||||||
import com.skcraft.launcher.model.modpack.Feature;
|
import com.skcraft.launcher.model.modpack.Feature;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
public class FeatureTableModel extends AbstractTableModel {
|
public class FeatureTableModel extends AbstractTableModel {
|
||||||
|
|
||||||
private final List<Feature> features;
|
private final List<Feature> features;
|
||||||
@ -25,7 +24,7 @@ public class FeatureTableModel extends AbstractTableModel {
|
|||||||
public String getColumnName(int columnIndex) {
|
public String getColumnName(int columnIndex) {
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case 1:
|
case 1:
|
||||||
return _("features.nameColumn");
|
return SharedLocale.tr("features.nameColumn");
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -96,9 +95,9 @@ public class FeatureTableModel extends AbstractTableModel {
|
|||||||
}
|
}
|
||||||
switch (feature.getRecommendation()) {
|
switch (feature.getRecommendation()) {
|
||||||
case STARRED:
|
case STARRED:
|
||||||
return " <span style=\"color: #3758DB\">" + _("features.starred") + "</span>";
|
return " <span style=\"color: #3758DB\">" + SharedLocale.tr("features.starred") + "</span>";
|
||||||
case AVOID:
|
case AVOID:
|
||||||
return " <span style=\"color: red\">" + _("features.avoid") + "</span>";
|
return " <span style=\"color: red\">" + SharedLocale.tr("features.avoid") + "</span>";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,12 @@ package com.skcraft.launcher.swing;
|
|||||||
import com.skcraft.launcher.Instance;
|
import com.skcraft.launcher.Instance;
|
||||||
import com.skcraft.launcher.InstanceList;
|
import com.skcraft.launcher.InstanceList;
|
||||||
import com.skcraft.launcher.Launcher;
|
import com.skcraft.launcher.Launcher;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
public class InstanceTableModel extends AbstractTableModel {
|
public class InstanceTableModel extends AbstractTableModel {
|
||||||
|
|
||||||
private final InstanceList instances;
|
private final InstanceList instances;
|
||||||
@ -44,7 +43,7 @@ public class InstanceTableModel extends AbstractTableModel {
|
|||||||
case 0:
|
case 0:
|
||||||
return "";
|
return "";
|
||||||
case 1:
|
case 1:
|
||||||
return _("launcher.modpackColumn");
|
return SharedLocale.tr("launcher.modpackColumn");
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -119,11 +118,11 @@ public class InstanceTableModel extends AbstractTableModel {
|
|||||||
|
|
||||||
private String getAddendum(Instance instance) {
|
private String getAddendum(Instance instance) {
|
||||||
if (!instance.isLocal()) {
|
if (!instance.isLocal()) {
|
||||||
return " <span style=\"color: #cccccc\">" + _("launcher.notInstalledHint") + "</span>";
|
return " <span style=\"color: #cccccc\">" + SharedLocale.tr("launcher.notInstalledHint") + "</span>";
|
||||||
} else if (!instance.isInstalled()) {
|
} else if (!instance.isInstalled()) {
|
||||||
return " <span style=\"color: red\">" + _("launcher.requiresUpdateHint") + "</span>";
|
return " <span style=\"color: red\">" + SharedLocale.tr("launcher.requiresUpdateHint") + "</span>";
|
||||||
} else if (instance.isUpdatePending()) {
|
} else if (instance.isUpdatePending()) {
|
||||||
return " <span style=\"color: #3758DB\">" + _("launcher.updatePendingHint") + "</span>";
|
return " <span style=\"color: #3758DB\">" + SharedLocale.tr("launcher.updatePendingHint") + "</span>";
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import com.google.common.util.concurrent.FutureCallback;
|
|||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.skcraft.launcher.LauncherException;
|
import com.skcraft.launcher.LauncherException;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import com.skcraft.launcher.util.SwingExecutor;
|
import com.skcraft.launcher.util.SwingExecutor;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
@ -35,7 +36,7 @@ import java.util.concurrent.CancellationException;
|
|||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
import static org.apache.commons.io.IOUtils.closeQuietly;
|
import static org.apache.commons.io.IOUtils.closeQuietly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,8 +70,8 @@ public final class SwingHelper {
|
|||||||
try {
|
try {
|
||||||
Desktop.getDesktop().open(file);
|
Desktop.getDesktop().open(file);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
JOptionPane.showMessageDialog(component, _("errors.openDirError", file.getAbsolutePath()),
|
JOptionPane.showMessageDialog(component, tr("errors.openDirError", file.getAbsolutePath()),
|
||||||
_("errorTitle"), JOptionPane.ERROR_MESSAGE);
|
SharedLocale.tr("errorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ public final class SwingHelper {
|
|||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(url.toURI());
|
Desktop.getDesktop().browse(url.toURI());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
showErrorDialog(parentComponent, _("errors.openUrlError", url.toString()), _("errorTitle"));
|
showErrorDialog(parentComponent, tr("errors.openUrlError", url.toString()), SharedLocale.tr("errorTitle"));
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +178,7 @@ public final class SwingHelper {
|
|||||||
|
|
||||||
// Add the extra details
|
// Add the extra details
|
||||||
if (detailsText != null) {
|
if (detailsText != null) {
|
||||||
JTextArea textArea = new JTextArea(_("errors.reportErrorPreface") + detailsText);
|
JTextArea textArea = new JTextArea(SharedLocale.tr("errors.reportErrorPreface") + detailsText);
|
||||||
JLabel tempLabel = new JLabel();
|
JLabel tempLabel = new JLabel();
|
||||||
textArea.setFont(tempLabel.getFont());
|
textArea.setFont(tempLabel.getFont());
|
||||||
textArea.setBackground(tempLabel.getBackground());
|
textArea.setBackground(tempLabel.getBackground());
|
||||||
@ -358,11 +359,11 @@ public final class SwingHelper {
|
|||||||
} else {
|
} else {
|
||||||
message = t.getLocalizedMessage();
|
message = t.getLocalizedMessage();
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
message = _("errors.genericError");
|
message = SharedLocale.tr("errors.genericError");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.log(Level.WARNING, "Task failed", t);
|
log.log(Level.WARNING, "Task failed", t);
|
||||||
SwingHelper.showErrorDialog(owner, message, _("errorTitle"), t);
|
SwingHelper.showErrorDialog(owner, message, SharedLocale.tr("errorTitle"), t);
|
||||||
}
|
}
|
||||||
}, SwingExecutor.INSTANCE);
|
}, SwingExecutor.INSTANCE);
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
package com.skcraft.launcher.swing;
|
package com.skcraft.launcher.swing;
|
||||||
|
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.text.JTextComponent;
|
import javax.swing.text.JTextComponent;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
public class TextFieldPopupMenu extends JPopupMenu implements ActionListener {
|
public class TextFieldPopupMenu extends JPopupMenu implements ActionListener {
|
||||||
|
|
||||||
public static final TextFieldPopupMenu INSTANCE = new TextFieldPopupMenu();
|
public static final TextFieldPopupMenu INSTANCE = new TextFieldPopupMenu();
|
||||||
@ -25,12 +25,12 @@ public class TextFieldPopupMenu extends JPopupMenu implements ActionListener {
|
|||||||
private final JMenuItem selectAllItem;
|
private final JMenuItem selectAllItem;
|
||||||
|
|
||||||
private TextFieldPopupMenu() {
|
private TextFieldPopupMenu() {
|
||||||
cutItem = addMenuItem(new JMenuItem(_("context.cut"), 'T'));
|
cutItem = addMenuItem(new JMenuItem(SharedLocale.tr("context.cut"), 'T'));
|
||||||
copyItem = addMenuItem(new JMenuItem(_("context.copy"), 'C'));
|
copyItem = addMenuItem(new JMenuItem(SharedLocale.tr("context.copy"), 'C'));
|
||||||
pasteItem = addMenuItem(new JMenuItem(_("context.paste"), 'P'));
|
pasteItem = addMenuItem(new JMenuItem(SharedLocale.tr("context.paste"), 'P'));
|
||||||
deleteItem = addMenuItem(new JMenuItem(_("context.delete"), 'D'));
|
deleteItem = addMenuItem(new JMenuItem(SharedLocale.tr("context.delete"), 'D'));
|
||||||
addSeparator();
|
addSeparator();
|
||||||
selectAllItem = addMenuItem(new JMenuItem(_("context.selectAll"), 'A'));
|
selectAllItem = addMenuItem(new JMenuItem(SharedLocale.tr("context.selectAll"), 'A'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JMenuItem addMenuItem(JMenuItem item) {
|
private JMenuItem addMenuItem(JMenuItem item) {
|
||||||
|
@ -24,6 +24,7 @@ import com.skcraft.launcher.model.modpack.ManifestEntry;
|
|||||||
import com.skcraft.launcher.persistence.Persistence;
|
import com.skcraft.launcher.persistence.Persistence;
|
||||||
import com.skcraft.launcher.util.Environment;
|
import com.skcraft.launcher.util.Environment;
|
||||||
import com.skcraft.launcher.util.HttpRequest;
|
import com.skcraft.launcher.util.HttpRequest;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
|
|
||||||
@ -37,7 +38,6 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
import static com.skcraft.launcher.LauncherUtils.checkInterrupted;
|
import static com.skcraft.launcher.LauncherUtils.checkInterrupted;
|
||||||
import static com.skcraft.launcher.LauncherUtils.concat;
|
import static com.skcraft.launcher.LauncherUtils.concat;
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of the various routines involved in downloading
|
* The base implementation of the various routines involved in downloading
|
||||||
@ -90,7 +90,7 @@ public abstract class BaseUpdater {
|
|||||||
.asJson(Manifest.class);
|
.asJson(Manifest.class);
|
||||||
|
|
||||||
if (manifest.getMinimumVersion() > Launcher.PROTOCOL_VERSION) {
|
if (manifest.getMinimumVersion() > Launcher.PROTOCOL_VERSION) {
|
||||||
throw new LauncherException("Update required", _("errors.updateRequiredError"));
|
throw new LauncherException("Update required", SharedLocale.tr("errors.updateRequiredError"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manifest.getBaseUrl() == null) {
|
if (manifest.getBaseUrl() == null) {
|
||||||
|
@ -17,7 +17,7 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
public class HardResetter implements Callable<Instance>, ProgressObservable {
|
public class HardResetter implements Callable<Instance>, ProgressObservable {
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class HardResetter implements Callable<Instance>, ProgressObservable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return _("instanceResetter.resetting", instance.getTitle());
|
return tr("instanceResetter.resetting", instance.getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import static com.skcraft.launcher.LauncherUtils.checkInterrupted;
|
import static com.skcraft.launcher.LauncherUtils.checkInterrupted;
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
import static com.skcraft.launcher.util.SharedLocale.tr;
|
||||||
|
|
||||||
public class Remover implements Callable<Instance>, ProgressObservable {
|
public class Remover implements Callable<Instance>, ProgressObservable {
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class Remover implements Callable<Instance>, ProgressObservable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return _("instanceDeleter.deleting", instance.getDir());
|
return tr("instanceDeleter.deleting", instance.getDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,7 +61,7 @@ public class Remover implements Callable<Instance>, ProgressObservable {
|
|||||||
|
|
||||||
if (failures.size() > 0) {
|
if (failures.size() > 0) {
|
||||||
throw new LauncherException(failures.size() + " failed to delete",
|
throw new LauncherException(failures.size() + " failed to delete",
|
||||||
_("instanceDeleter.failures", failures.size()));
|
tr("instanceDeleter.failures", failures.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
|
@ -18,6 +18,7 @@ import com.skcraft.launcher.model.minecraft.VersionManifest;
|
|||||||
import com.skcraft.launcher.model.modpack.Manifest;
|
import com.skcraft.launcher.model.modpack.Manifest;
|
||||||
import com.skcraft.launcher.persistence.Persistence;
|
import com.skcraft.launcher.persistence.Persistence;
|
||||||
import com.skcraft.launcher.util.HttpRequest;
|
import com.skcraft.launcher.util.HttpRequest;
|
||||||
|
import com.skcraft.launcher.util.SharedLocale;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -33,7 +34,6 @@ import java.util.concurrent.ExecutionException;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.skcraft.launcher.util.HttpRequest.url;
|
import static com.skcraft.launcher.util.HttpRequest.url;
|
||||||
import static com.skcraft.launcher.util.SharedLocale._;
|
|
||||||
|
|
||||||
@Log
|
@Log
|
||||||
public class Updater extends BaseUpdater implements Callable<Instance>, ProgressObservable {
|
public class Updater extends BaseUpdater implements Callable<Instance>, ProgressObservable {
|
||||||
@ -49,7 +49,7 @@ public class Updater extends BaseUpdater implements Callable<Instance>, Progress
|
|||||||
private List<URL> librarySources = new ArrayList<URL>();
|
private List<URL> librarySources = new ArrayList<URL>();
|
||||||
private List<URL> assetsSources = new ArrayList<URL>();
|
private List<URL> assetsSources = new ArrayList<URL>();
|
||||||
|
|
||||||
private ProgressObservable progress = new DefaultProgress(-1, _("instanceUpdater.preparingUpdate"));
|
private ProgressObservable progress = new DefaultProgress(-1, SharedLocale.tr("instanceUpdater.preparingUpdate"));
|
||||||
|
|
||||||
public Updater(@NonNull Launcher launcher, @NonNull Instance instance) {
|
public Updater(@NonNull Launcher launcher, @NonNull Instance instance) {
|
||||||
super(launcher);
|
super(launcher);
|
||||||
@ -72,14 +72,14 @@ public class Updater extends BaseUpdater implements Callable<Instance>, Progress
|
|||||||
|
|
||||||
if (!online && updateRequired) {
|
if (!online && updateRequired) {
|
||||||
log.info("Can't update " + instance.getTitle() + " because offline");
|
log.info("Can't update " + instance.getTitle() + " because offline");
|
||||||
String message = _("updater.updateRequiredButOffline");
|
String message = SharedLocale.tr("updater.updateRequiredButOffline");
|
||||||
throw new LauncherException("Update required but currently offline", message);
|
throw new LauncherException("Update required but currently offline", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateDesired && !updateCapable) {
|
if (updateDesired && !updateCapable) {
|
||||||
if (updateRequired) {
|
if (updateRequired) {
|
||||||
log.info("Update required for " + instance.getTitle() + " but there is no manifest");
|
log.info("Update required for " + instance.getTitle() + " but there is no manifest");
|
||||||
String message = _("updater.updateRequiredButNoManifest");
|
String message = SharedLocale.tr("updater.updateRequiredButNoManifest");
|
||||||
throw new LauncherException("Update required but no manifest", message);
|
throw new LauncherException("Update required but no manifest", message);
|
||||||
} else {
|
} else {
|
||||||
log.info("Can't update " + instance.getTitle() + ", but update is not required");
|
log.info("Can't update " + instance.getTitle() + ", but update is not required");
|
||||||
@ -134,7 +134,7 @@ public class Updater extends BaseUpdater implements Callable<Instance>, Progress
|
|||||||
|
|
||||||
// Read manifest
|
// Read manifest
|
||||||
log.info("Reading package manifest...");
|
log.info("Reading package manifest...");
|
||||||
progress = new DefaultProgress(-1, _("instanceUpdater.readingManifest"));
|
progress = new DefaultProgress(-1, SharedLocale.tr("instanceUpdater.readingManifest"));
|
||||||
Manifest manifest = installPackage(installer, instance);
|
Manifest manifest = installPackage(installer, instance);
|
||||||
|
|
||||||
// Update instance from manifest
|
// Update instance from manifest
|
||||||
@ -142,10 +142,10 @@ public class Updater extends BaseUpdater implements Callable<Instance>, Progress
|
|||||||
|
|
||||||
// Read version manifest
|
// Read version manifest
|
||||||
log.info("Reading version manifest...");
|
log.info("Reading version manifest...");
|
||||||
progress = new DefaultProgress(-1, _("instanceUpdater.readingVersion"));
|
progress = new DefaultProgress(-1, SharedLocale.tr("instanceUpdater.readingVersion"));
|
||||||
VersionManifest version = readVersionManifest(manifest);
|
VersionManifest version = readVersionManifest(manifest);
|
||||||
|
|
||||||
progress = new DefaultProgress(-1, _("instanceUpdater.buildingDownloadList"));
|
progress = new DefaultProgress(-1, SharedLocale.tr("instanceUpdater.buildingDownloadList"));
|
||||||
|
|
||||||
// Install the .jar
|
// Install the .jar
|
||||||
File jarPath = launcher.getJarPath(version);
|
File jarPath = launcher.getJarPath(version);
|
||||||
@ -162,12 +162,12 @@ public class Updater extends BaseUpdater implements Callable<Instance>, Progress
|
|||||||
librarySources.add(url);
|
librarySources.add(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
progress = new DefaultProgress(-1, _("instanceUpdater.collectingLibraries"));
|
progress = new DefaultProgress(-1, SharedLocale.tr("instanceUpdater.collectingLibraries"));
|
||||||
installLibraries(installer, version, launcher.getLibrariesDir(), librarySources);
|
installLibraries(installer, version, launcher.getLibrariesDir(), librarySources);
|
||||||
|
|
||||||
// Download assets
|
// Download assets
|
||||||
log.info("Enumerating assets to download...");
|
log.info("Enumerating assets to download...");
|
||||||
progress = new DefaultProgress(-1, _("instanceUpdater.collectingAssets"));
|
progress = new DefaultProgress(-1, SharedLocale.tr("instanceUpdater.collectingAssets"));
|
||||||
installAssets(installer, version, launcher.propUrl("assetsIndexUrl", version.getAssetsIndex()), assetsSources);
|
installAssets(installer, version, launcher.propUrl("assetsIndexUrl", version.getAssetsIndex()), assetsSources);
|
||||||
|
|
||||||
log.info("Executing download phase...");
|
log.info("Executing download phase...");
|
||||||
|
@ -50,7 +50,7 @@ public class SharedLocale {
|
|||||||
* @param key the key
|
* @param key the key
|
||||||
* @return the translated string
|
* @return the translated string
|
||||||
*/
|
*/
|
||||||
public static String _(String key) {
|
public static String tr(String key) {
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
try {
|
try {
|
||||||
return bundle.getString(key);
|
return bundle.getString(key);
|
||||||
@ -71,10 +71,10 @@ public class SharedLocale {
|
|||||||
* @param args arguments
|
* @param args arguments
|
||||||
* @return a translated string
|
* @return a translated string
|
||||||
*/
|
*/
|
||||||
public static String _(String key, Object... args) {
|
public static String tr(String key, Object... args) {
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
try {
|
try {
|
||||||
MessageFormat formatter = new MessageFormat(_(key));
|
MessageFormat formatter = new MessageFormat(tr(key));
|
||||||
formatter.setLocale(getLocale());
|
formatter.setLocale(getLocale());
|
||||||
return formatter.format(args);
|
return formatter.format(args);
|
||||||
} catch (MissingResourceException e) {
|
} catch (MissingResourceException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user