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