mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
translate online game message
This commit is contained in:
@@ -32,6 +32,7 @@ import forge.toolbox.FTextField;
|
||||
import forge.toolbox.SmartScroller;
|
||||
import forge.view.FDialog;
|
||||
import forge.view.FFrame;
|
||||
import forge.util.Localizer;
|
||||
|
||||
|
||||
public enum FNetOverlay implements IOnlineChatInterface {
|
||||
@@ -73,7 +74,7 @@ public enum FNetOverlay implements IOnlineChatInterface {
|
||||
|
||||
private final FTextArea txtLog = new FTextArea();
|
||||
private final FTextField txtInput = new FTextField.Builder().maxLength(255).build();
|
||||
private final FLabel cmdSend = new FLabel.ButtonBuilder().text("Send").build();
|
||||
private final FLabel cmdSend = new FLabel.ButtonBuilder().text(Localizer.getInstance().getMessage("lblSend")).build();
|
||||
|
||||
//private boolean minimized = false;
|
||||
private int height = 140;
|
||||
@@ -106,7 +107,7 @@ public enum FNetOverlay implements IOnlineChatInterface {
|
||||
* Semi-transparent overlay panel. Should be used with layered panes.
|
||||
*/
|
||||
FNetOverlay() {
|
||||
window.setTitle("Chat");
|
||||
window.setTitle(Localizer.getInstance().getMessage("lblChat"));
|
||||
window.setVisible(false);
|
||||
window.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
window.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.toolbox.FSkin.Colors;
|
||||
import forge.toolbox.FSkin.SkinColor;
|
||||
import forge.toolbox.FSkin.SkinnedCheckBox;
|
||||
import forge.toolbox.FSkin.SkinnedPanel;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -190,7 +191,7 @@ public abstract class ItemFilter<T extends InventoryItem> {
|
||||
private boolean pressed, hovered;
|
||||
|
||||
private RemoveButton() {
|
||||
setToolTipText("Remove filter");
|
||||
setToolTipText(Localizer.getInstance().getMessage("lblRemoveFilter"));
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import forge.screens.home.CLobby;
|
||||
import forge.screens.home.VLobby;
|
||||
import forge.screens.home.sanctioned.ConstructedGameMenu;
|
||||
import forge.util.gui.SOptionPane;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public enum CSubmenuOnlineLobby implements ICDoc, IMenuProvider {
|
||||
SINGLETON_INSTANCE;
|
||||
@@ -49,7 +50,7 @@ public enum CSubmenuOnlineLobby implements ICDoc, IMenuProvider {
|
||||
} catch (Exception ex) {
|
||||
// IntelliJ swears that BindException isn't thrown in this try block, but it is!
|
||||
if (ex.getClass() == BindException.class) {
|
||||
SOptionPane.showErrorDialog("Unable to start server, port already in use!");
|
||||
SOptionPane.showErrorDialog(Localizer.getInstance().getMessage("lblUnableStartServerPortAlreadyUse"));
|
||||
SOverlayUtils.hideOverlay();
|
||||
} else {
|
||||
BugReporter.reportException(ex);
|
||||
@@ -64,7 +65,7 @@ public enum CSubmenuOnlineLobby implements ICDoc, IMenuProvider {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SOverlayUtils.startGameOverlay("Starting server...");
|
||||
SOverlayUtils.startGameOverlay(Localizer.getInstance().getMessage("lblStartingServer"));
|
||||
SOverlayUtils.showOverlay();
|
||||
}
|
||||
});
|
||||
@@ -88,7 +89,7 @@ public enum CSubmenuOnlineLobby implements ICDoc, IMenuProvider {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SOverlayUtils.startGameOverlay("Connecting to server...");
|
||||
SOverlayUtils.startGameOverlay(Localizer.getInstance().getMessage("lblConnectingToServer"));
|
||||
SOverlayUtils.showOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ public enum VSubmenuOnlineLobby implements IVSubmenu<CSubmenuOnlineLobby>, IOnli
|
||||
|
||||
container.setLayout(new MigLayout("insets 0, gap 0, wrap 1, ax right"));
|
||||
|
||||
lobby.getLblTitle().setText("Online Multiplayer: Lobby");
|
||||
lobby.getLblTitle().setText(Localizer.getInstance().getMessage("lblOnlineLobbyTitle"));
|
||||
pnlTitle.removeAll();
|
||||
pnlTitle.setOpaque(false);
|
||||
pnlTitle.add(lobby.getLblTitle(), "w 95%, h 40px!, gap 0 0 15px 15px, span 2");
|
||||
|
||||
@@ -11,11 +11,12 @@ import forge.properties.ForgePreferences.FPref;
|
||||
import forge.screens.FScreen;
|
||||
import forge.toolbox.FEvent;
|
||||
import forge.toolbox.FEvent.FEventHandler;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class OnlineMenu extends FPopupMenu {
|
||||
public enum OnlineScreen {
|
||||
Lobby("Lobby", FSkinImage.FAVICON, OnlineLobbyScreen.class),
|
||||
Chat("Chat", FSkinImage.QUEST_NOTES, OnlineChatScreen.class);
|
||||
Lobby("lblLobby", FSkinImage.FAVICON, OnlineLobbyScreen.class),
|
||||
Chat("lblChat", FSkinImage.QUEST_NOTES, OnlineChatScreen.class);
|
||||
|
||||
private final FMenuItem item;
|
||||
private final Class<? extends FScreen> screenClass;
|
||||
@@ -23,7 +24,7 @@ public class OnlineMenu extends FPopupMenu {
|
||||
|
||||
OnlineScreen(final String caption0, final FImage icon0, final Class<? extends FScreen> screenClass0) {
|
||||
screenClass = screenClass0;
|
||||
item = new FMenuItem(caption0, icon0, new FEventHandler() {
|
||||
item = new FMenuItem(Localizer.getInstance().getMessage(caption0), icon0, new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
Forge.back(); //remove current screen from chain
|
||||
@@ -37,7 +38,7 @@ public class OnlineMenu extends FPopupMenu {
|
||||
if (screen == null) { //don't initialize screen until it's opened the first time
|
||||
try {
|
||||
screen = screenClass.newInstance();
|
||||
screen.setHeaderCaption("Play Online - " + item.getText());
|
||||
screen.setHeaderCaption(Localizer.getInstance().getMessage("lblPlayOnline") + " - " + item.getText());
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -37,6 +37,7 @@ import forge.model.FModel;
|
||||
import forge.net.event.UpdateLobbyPlayerEvent;
|
||||
import forge.player.GamePlayerUtil;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.NameGenerator;
|
||||
import forge.util.gui.SOptionPane;
|
||||
|
||||
@@ -353,27 +354,27 @@ public abstract class GameLobby implements IHasGameType {
|
||||
}
|
||||
|
||||
if (activeSlots.size() < 2) {
|
||||
SOptionPane.showMessageDialog("At least two players are required to start a game.");
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblRequiredLeastTwoPlayerStartGame"));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isEnoughTeams()) {
|
||||
SOptionPane.showMessageDialog("There are not enough teams! Please adjust team allocations.");
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblNotEnoughTeams"));
|
||||
return null;
|
||||
}
|
||||
|
||||
for (final LobbySlot slot : activeSlots) {
|
||||
if (!slot.isReady() && slot.getType() != LobbySlotType.OPEN) {
|
||||
SOptionPane.showMessageDialog(TextUtil.concatNoSpace("Player ", slot.getName(), " is not ready"));
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblPlayerIsNotReady", slot.getName()));
|
||||
return null;
|
||||
}
|
||||
if (slot.getDeck() == null) {
|
||||
SOptionPane.showMessageDialog(TextUtil.concatNoSpace("Please specify a deck for ", slot.getName()));
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblPleaseSpecifyPlayerDeck", slot.getName()));
|
||||
return null;
|
||||
}
|
||||
if (hasVariant(GameType.Commander) || hasVariant(GameType.Oathbreaker) || hasVariant(GameType.TinyLeaders) || hasVariant(GameType.Brawl)) {
|
||||
if (!slot.getDeck().has(DeckSection.Commander)) {
|
||||
SOptionPane.showMessageDialog(TextUtil.concatNoSpace(slot.getName(), " doesn't have a commander"));
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblPlayerDoesntHaveCommander", slot.getName()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -410,7 +411,7 @@ public abstract class GameLobby implements IHasGameType {
|
||||
final String name = slot.getName();
|
||||
final String errMsg = GameType.Constructed.getDeckFormat().getDeckConformanceProblem(slot.getDeck());
|
||||
if (null != errMsg) {
|
||||
SOptionPane.showErrorDialog(name + "'s deck " + errMsg, "Invalid Deck");
|
||||
SOptionPane.showErrorDialog(Localizer.getInstance().getMessage("lblPlayerDeckError", name, errMsg), Localizer.getInstance().getMessage("lblInvalidDeck"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -460,7 +461,7 @@ public abstract class GameLobby implements IHasGameType {
|
||||
if (checkLegality) {
|
||||
final String errMsg = commanderGameType.getDeckFormat().getDeckConformanceProblem(deck);
|
||||
if (errMsg != null) {
|
||||
SOptionPane.showErrorDialog(name + "'s deck " + errMsg, "Invalid " + commanderGameType + " Deck");
|
||||
SOptionPane.showErrorDialog(Localizer.getInstance().getMessage("lblPlayerDeckError", name, errMsg), Localizer.getInstance().getMessage("lblInvalidCommanderGameTypeDeck", commanderGameType));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -491,7 +492,7 @@ public abstract class GameLobby implements IHasGameType {
|
||||
if (checkLegality) {
|
||||
final String errMsg = DeckFormat.getSchemeSectionConformanceProblem(schemePool);
|
||||
if (null != errMsg) {
|
||||
SOptionPane.showErrorDialog(name + "'s deck " + errMsg, "Invalid Scheme Deck");
|
||||
SOptionPane.showErrorDialog(Localizer.getInstance().getMessage("lblPlayerDeckError", name, errMsg), Localizer.getInstance().getMessage("lblInvalidSchemeDeck"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -504,7 +505,7 @@ public abstract class GameLobby implements IHasGameType {
|
||||
if (checkLegality) {
|
||||
final String errMsg = DeckFormat.getPlaneSectionConformanceProblem(planePool);
|
||||
if (null != errMsg) {
|
||||
SOptionPane.showErrorDialog(name + "'s deck " + errMsg, "Invalid Planar Deck");
|
||||
SOptionPane.showErrorDialog(Localizer.getInstance().getMessage("lblPlayerDeckError", name, errMsg), Localizer.getInstance().getMessage("lblInvalidPlanarDeck"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -514,8 +515,7 @@ public abstract class GameLobby implements IHasGameType {
|
||||
//Vanguard
|
||||
if (variantTypes.contains(GameType.Vanguard)) {
|
||||
if (avatarPool == null || avatarPool.countAll() == 0) { //ERROR! null if avatar deselected on list
|
||||
SOptionPane.showMessageDialog("No Vanguard avatar selected for " + name
|
||||
+ ". Please choose one or disable the Vanguard variant");
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblNoSelectedVanguardAvatarForPlayer", name));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,13 @@ import forge.player.GamePlayerUtil;
|
||||
import forge.properties.ForgeProfileProperties;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.gui.SOptionPane;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class NetConnectUtil {
|
||||
private NetConnectUtil() { }
|
||||
|
||||
public static String getServerUrl() {
|
||||
final String url = SOptionPane.showInputDialog("This feature is under active development.\nYou are likely to find bugs.\n\n - = * H E R E B E E L D R A Z I * = -\n\nEnter the URL of the server to join.\nLeave blank to host your own server.", "Connect to Server");
|
||||
final String url = SOptionPane.showInputDialog(Localizer.getInstance().getMessage("lblOnlineMultiplayerDest"), Localizer.getInstance().getMessage("lblConnectToServer"));
|
||||
if (url == null) { return null; }
|
||||
|
||||
//prompt user for player one name if needed
|
||||
@@ -101,7 +102,7 @@ public class NetConnectUtil {
|
||||
|
||||
view.update(true);
|
||||
|
||||
return new ChatMessage(null, String.format("Hosting on port %d.", port));
|
||||
return new ChatMessage(null, Localizer.getInstance().getMessage("lblHostingPortOnN", String.valueOf(port)));
|
||||
}
|
||||
|
||||
public static void copyHostedServerUrl() {
|
||||
@@ -116,13 +117,13 @@ public class NetConnectUtil {
|
||||
GuiBase.getInterface().copyToClipboard(internalAddress);
|
||||
}
|
||||
|
||||
String message = "Share the following URL with anyone who wishes to join your server. It has been copied to your clipboard for convenience.\n\n";
|
||||
String message = "";
|
||||
if (externalUrl != null) {
|
||||
message += externalUrl + "\n\nFor internal games, use the following URL: " + internalUrl;
|
||||
message = Localizer.getInstance().getMessage("lblShareURLToMakePlayerJoinServer", externalUrl, internalUrl);
|
||||
} else {
|
||||
message = "Forge was unable to determine your external IP!\n\n" + message + internalUrl;
|
||||
message = Localizer.getInstance().getMessage("lblForgeUnableDetermineYourExternalIP", message + internalUrl);
|
||||
}
|
||||
SOptionPane.showMessageDialog(message, "Server URL", SOptionPane.INFORMATION_ICON);
|
||||
SOptionPane.showMessageDialog(message, Localizer.getInstance().getMessage("lblServerURL"), SOptionPane.INFORMATION_ICON);
|
||||
}
|
||||
|
||||
public static ChatMessage join(final String url, final IOnlineLobby onlineLobby, final IOnlineChatInterface chatInterface) {
|
||||
@@ -145,7 +146,7 @@ public class NetConnectUtil {
|
||||
}
|
||||
@Override
|
||||
public final void close() {
|
||||
SOptionPane.showMessageDialog("Your connection to the host (" + url + ") was interrupted.", "Error", FSkinProp.ICO_WARNING);
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblYourConnectionToHostWasInterrupted", url), Localizer.getInstance().getMessage("lblError"), FSkinProp.ICO_WARNING);
|
||||
onlineLobby.setClient(null);
|
||||
}
|
||||
@Override
|
||||
@@ -181,6 +182,6 @@ public class NetConnectUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ChatMessage(null, String.format("Connected to %s:%d", hostname, port));
|
||||
return new ChatMessage(null, Localizer.getInstance().getMessage("lblConnectedIPPort", hostname, String.valueOf(port)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user