mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
translate online game message
This commit is contained in:
@@ -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