1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-27 12:46:22 +01:00

[Bootstrap] Rename _() to tr().

This commit is contained in:
sk89q 2015-07-24 17:06:42 -07:00
parent 8c1c871484
commit b06600a376
5 changed files with 17 additions and 17 deletions

View File

@ -23,7 +23,7 @@ import java.net.URLClassLoader;
import java.util.*;
import java.util.logging.Level;
import static com.skcraft.launcher.bootstrap.SharedLocale._;
import static com.skcraft.launcher.bootstrap.SharedLocale.tr;
@Log
public class Bootstrap {
@ -49,7 +49,7 @@ public class Bootstrap {
} catch (Throwable t) {
Bootstrap.log.log(Level.WARNING, "Error", t);
Bootstrap.setSwingLookAndFeel();
SwingHelper.showErrorDialog(null, _("errors.bootstrapError"), _("errorTitle"), t);
SwingHelper.showErrorDialog(null, tr("errors.bootstrapError"), tr("errorTitle"), t);
}
}

View File

@ -18,7 +18,7 @@ import java.awt.event.WindowEvent;
import java.util.Timer;
import java.util.TimerTask;
import static com.skcraft.launcher.bootstrap.SharedLocale._;
import static com.skcraft.launcher.bootstrap.SharedLocale.tr;
@Log
public class DownloadFrame extends JFrame {
@ -31,13 +31,13 @@ public class DownloadFrame extends JFrame {
private final JPanel textAreaPanel = new JPanel(new BorderLayout());
private final JProgressBar progressBar = new JProgressBar();
private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true);
private final JButton cancelButton = new JButton(_("button.cancal"));
private final JButton cancelButton = new JButton(tr("button.cancal"));
public DownloadFrame(ProgressObservable observable) {
super(_("downloader.title"));
super(tr("downloader.title"));
setResizable(false);
initComponents();
label.setText(_("downloader.pleaseWait"));
label.setText(tr("downloader.pleaseWait"));
setMinimumSize(new Dimension(400, 100));
pack();
setLocationRelativeTo(null);
@ -87,7 +87,7 @@ public class DownloadFrame extends JFrame {
}
private boolean confirmCancel() {
return SwingHelper.confirmDialog(this, _("progress.confirmCancel"), _("progress.confirmCancelTitle"));
return SwingHelper.confirmDialog(this, tr("progress.confirmCancel"), tr("progress.confirmCancelTitle"));
}
private void cancel() {
@ -138,7 +138,7 @@ public class DownloadFrame extends JFrame {
progressBar.setValue((int) (1000 * progress));
}
} else {
label.setText(_("downloader.pleaseWait"));
label.setText(tr("downloader.pleaseWait"));
progressBar.setIndeterminate(true);
}
}

View File

@ -20,7 +20,7 @@ import java.util.List;
import java.util.logging.Level;
import static com.skcraft.launcher.bootstrap.BootstrapUtils.checkInterrupted;
import static com.skcraft.launcher.bootstrap.SharedLocale._;
import static com.skcraft.launcher.bootstrap.SharedLocale.tr;
@Log
public class Downloader implements Runnable, ProgressObservable {
@ -45,7 +45,7 @@ public class Downloader implements Runnable, ProgressObservable {
System.exit(0);
} catch (Throwable t) {
log.log(Level.WARNING, "Failed to download launcher", t);
SwingHelper.showErrorDialog(null, _("errors.failedDownloadError"), _("errorTitle"), t);
SwingHelper.showErrorDialog(null, tr("errors.failedDownloadError"), tr("errorTitle"), t);
System.exit(0);
}
}
@ -128,11 +128,11 @@ public class Downloader implements Runnable, ProgressObservable {
if (httpRequest != null) {
double progress = httpRequest.getProgress();
if (progress >= 0) {
return String.format(_("downloader.progressStatus"), progress * 100);
return String.format(tr("downloader.progressStatus"), progress * 100);
}
}
return _("downloader.status");
return tr("downloader.status");
}
@Override

View File

@ -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) {

View File

@ -22,7 +22,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.skcraft.launcher.bootstrap.BootstrapUtils.closeQuietly;
import static com.skcraft.launcher.bootstrap.SharedLocale._;
import static com.skcraft.launcher.bootstrap.SharedLocale.tr;
/**
* Swing utility methods.
@ -114,7 +114,7 @@ public final class SwingHelper {
// Add the extra details
if (detailsText != null) {
JTextArea textArea = new JTextArea(_("errorDialog.reportError") + "\n\n" + detailsText);
JTextArea textArea = new JTextArea(tr("errorDialog.reportError") + "\n\n" + detailsText);
JLabel tempLabel = new JLabel();
textArea.setFont(tempLabel.getFont());
textArea.setBackground(tempLabel.getBackground());