diff --git a/forge-game/src/main/java/forge/game/GameOutcome.java b/forge-game/src/main/java/forge/game/GameOutcome.java index 505dd11de99..d6f3481c3d6 100644 --- a/forge-game/src/main/java/forge/game/GameOutcome.java +++ b/forge-game/src/main/java/forge/game/GameOutcome.java @@ -234,6 +234,6 @@ public final class GameOutcome implements Iterable { lblStats.setHorizontalAlignment(SwingConstants.CENTER); lblStats.setFont(FSkin.getRelativeFont(26)); - btnContinue.setText("Next Game"); + final Localizer localizer = Localizer.getInstance(); + btnContinue.setText(localizer.getMessage("btnNextGame")); btnContinue.setFont(FSkin.getRelativeFont(22)); - btnRestart.setText("Start New Match"); + btnRestart.setText(localizer.getMessage("btnStartNewMatch")); btnRestart.setFont(FSkin.getRelativeFont(22)); - btnQuit.setText("Quit Match"); + btnQuit.setText(localizer.getMessage("btnQuitMatch")); btnQuit.setFont(FSkin.getRelativeFont(22)); btnContinue.setEnabled(!game0.isMatchOver()); @@ -130,7 +132,7 @@ public class ViewWinLose implements IWinLoseView { txtLog.setFont(FSkin.getRelativeFont(14)); txtLog.setFocusable(true); // allow highlighting and copying of log - final FLabel btnCopyLog = new FLabel.ButtonBuilder().text("Copy to clipboard").build(); + final FLabel btnCopyLog = new FLabel.ButtonBuilder().text(localizer.getMessage("btnCopyToClipboard")).build(); btnCopyLog.setCommand(new UiCommand() { @Override public void run() { @@ -178,7 +180,7 @@ public class ViewWinLose implements IWinLoseView { pnlLog.setOpaque(false); pnlLog.add( - new FLabel.Builder().text("Game Log").fontAlign(SwingConstants.CENTER).fontSize(18) + new FLabel.Builder().text(localizer.getMessage("lblGameLog")).fontAlign(SwingConstants.CENTER).fontSize(18) .fontStyle(Font.BOLD).build(), "w 300px!, h 28px!, gaptop 20px"); pnlLog.add(scrLog, "w 300px!, h 100px!, gap 0 0 10 10"); @@ -214,12 +216,13 @@ public class ViewWinLose implements IWinLoseView { private static String composeTitle(final GameView game) { final String winner = game.getWinningPlayerName(); final int winningTeam = game.getWinningTeam(); + final Localizer localizer = Localizer.getInstance(); if (winner == null || winner.isEmpty()) { - return "It's a draw!"; + return localizer.getMessage("lblItsADraw"); } else if (winningTeam != -1) { - return TextUtil.concatNoSpace("Team ", String.valueOf(winningTeam), " won!"); + return localizer.getMessage("lblTeamWon").replace("%s", String.valueOf(winningTeam)); } else { - return TextUtil.concatNoSpace(winner, " won!"); + return localizer.getMessage("lblWinnerWon").replace("%s", winner); } } diff --git a/forge-gui-mobile/src/forge/screens/match/winlose/ViewWinLose.java b/forge-gui-mobile/src/forge/screens/match/winlose/ViewWinLose.java index 799ee3211d8..d4b03e15338 100644 --- a/forge-gui-mobile/src/forge/screens/match/winlose/ViewWinLose.java +++ b/forge-gui-mobile/src/forge/screens/match/winlose/ViewWinLose.java @@ -23,6 +23,7 @@ import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FLabel; import forge.toolbox.FOverlay; import forge.toolbox.FTextArea; +import forge.util.Localizer; import forge.util.TextUtil; import forge.util.Utils; import forge.util.gui.SGuiChoose; @@ -86,15 +87,16 @@ public class ViewWinLose extends FOverlay implements IWinLoseView { control = new ControlWinLose(this, game0); } - btnContinue.setText("Next Game"); + final Localizer localizer = Localizer.getInstance(); + btnContinue.setText(localizer.getMessage("btnNextGame")); btnContinue.setFont(FSkinFont.get(22)); - btnRestart.setText("Start New Match"); + btnRestart.setText(localizer.getMessage("btnStartNewMatch")); btnRestart.setFont(btnContinue.getFont()); - btnQuit.setText("Quit Match"); + btnQuit.setText(localizer.getMessage("btnQuitMatch")); btnQuit.setFont(btnContinue.getFont()); btnContinue.setEnabled(!game0.isMatchOver()); - lblLog = add(new FLabel.Builder().text("Game Log").align(Align.center).font(FSkinFont.get(18)).build()); + lblLog = add(new FLabel.Builder().text(localizer.getMessage("lblGameLog")).align(Align.center).font(FSkinFont.get(18)).build()); txtLog = add(new FTextArea(true, StringUtils.join(game.getGameLog().getLogEntries(null), "\r\n").replace("[COMPUTER]", "[AI]")) { @Override public boolean tap(float x, float y, int count) { @@ -106,7 +108,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView { }); txtLog.setFont(FSkinFont.get(12)); - btnCopyLog = add(new FLabel.ButtonBuilder().text("Copy to clipboard").command(new FEventHandler() { + btnCopyLog = add(new FLabel.ButtonBuilder().text(localizer.getMessage("btnCopyToClipboard")).command(new FEventHandler() { @Override public void handleEvent(FEvent e) { Forge.getClipboard().setContents(txtLog.getText()); @@ -123,12 +125,13 @@ public class ViewWinLose extends FOverlay implements IWinLoseView { private String composeTitle(final GameView game) { final String winner = game.getWinningPlayerName(); final int winningTeam = game.getWinningTeam(); + final Localizer localizer = Localizer.getInstance(); if (winner == null) { - return "It's a draw!"; + return localizer.getMessage("lblItsADraw"); } else if (winningTeam != -1) { - return TextUtil.concatNoSpace("Team ", String.valueOf(winningTeam), " won!"); + return localizer.getMessage("lblTeamWon").replace("%s", String.valueOf(winningTeam)); } else { - return TextUtil.concatNoSpace(winner, " won!"); + return localizer.getMessage("lblWinnerWon").replace("%s", winner); } } diff --git a/forge-gui/res/languages/de-DE.properties b/forge-gui/res/languages/de-DE.properties index 03dd9b57e10..5708689a114 100644 --- a/forge-gui/res/languages/de-DE.properties +++ b/forge-gui/res/languages/de-DE.properties @@ -1140,3 +1140,35 @@ lblArrangeCardsToBePutOnTopOfYourLibrary=Ordne Karten, welche unter die Biblioth lblTopOfLibrary=Oben auf Bibliothek lblSelectCardsToBePutIntoTheGraveyard=Wähle Karten, welche auf den Friedhof gelegt werden sollen lblCardsToPutInTheGraveyard=Karten, welche auf den Friedhof gelegt werden sollen +#AbstractGuiGame.java +lblConcedeCurrentGame=This will concede the current game and you will lose.\n\nConcede anyway? +lblConcedeTitle=Concede Game? +lblConcede=Concede +lblCloseGameSpectator=This will close this game and you will not be able to resume watching it.\n\nClose anyway? +lblCloseGame=Close Game? +lblWaitingForOpponent=Waiting for opponent... +lblYieldingUntilEndOfTurn=Yielding until end of turn.\nYou may cancel this yield to take an action. +lblStopWatching=Stop Watching +lblEnterNumberBetweenMinAndMax=Enter a number between %min and %max: +lblEnterNumberGreaterThanOrEqualsToMin=Enter a number greater than or equal to %min: +lblEnterNumberLessThanOrEqualsToMax=Enter a number less than or equal to %max: +#PlayerOutcome.java +lblWonBecauseAllOpponentsHaveLost=has won because all opponents have lost +lblWonDueToEffectOf=has won due to effect of '%s' +lblConceded=has conceded +lblLostTryingToDrawCardsFromEmptyLibrary=has lost trying to draw cards from empty library +lblLostBecauseLifeTotalReachedZero=has lost because life total reached 0 +lblLostBecauseOfObtainingTenPoisonCounters=has lost because of obtaining 10 poison counters +lblLostBecauseAnOpponentHasWonBySpell=has lost because an opponent has won by spell '%s' +lblLostDueToEffectOfSpell=has lost due to effect of spell '%s' +lblLostDueToAccumulationOf21DamageFromGenerals=has lost due to accumulation of 21 damage from generals +lblAcceptedThatTheGameIsADraw=has accepted that the game is a draw +lblLostForUnknownReasonBug=has lost for unknown reason (this is a bug) +#ViewWinLose.java +btnNextGame=Next Game +btnStartNewMatch=Start New Match +btnQuitMatch=Quit Match +lblItsADraw=It's a draw! +lblTeamWon=Team %s won! +lblWinnerWon=%s won! +lblGameLog=Game Log \ No newline at end of file diff --git a/forge-gui/res/languages/en-US.properties b/forge-gui/res/languages/en-US.properties index 05205404536..f5754b44fed 100644 --- a/forge-gui/res/languages/en-US.properties +++ b/forge-gui/res/languages/en-US.properties @@ -1139,4 +1139,36 @@ lblCardsToPutOnTheBottom=Cards to put on the bottom lblArrangeCardsToBePutOnTopOfYourLibrary=Arrange cards to be put on top of your library lblTopOfLibrary=Top of Library lblSelectCardsToBePutIntoTheGraveyard=Select cards to be put into the graveyard -lblCardsToPutInTheGraveyard=Cards to put in the graveyard \ No newline at end of file +lblCardsToPutInTheGraveyard=Cards to put in the graveyard +#AbstractGuiGame.java +lblConcedeCurrentGame=This will concede the current game and you will lose.\n\nConcede anyway? +lblConcedeTitle=Concede Game? +lblConcede=Concede +lblCloseGameSpectator=This will close this game and you will not be able to resume watching it.\n\nClose anyway? +lblCloseGame=Close Game? +lblWaitingForOpponent=Waiting for opponent... +lblYieldingUntilEndOfTurn=Yielding until end of turn.\nYou may cancel this yield to take an action. +lblStopWatching=Stop Watching +lblEnterNumberBetweenMinAndMax=Enter a number between %min and %max: +lblEnterNumberGreaterThanOrEqualsToMin=Enter a number greater than or equal to %min: +lblEnterNumberLessThanOrEqualsToMax=Enter a number less than or equal to %max: +#PlayerOutcome.java +lblWonBecauseAllOpponentsHaveLost=has won because all opponents have lost +lblWonDueToEffectOf=has won due to effect of '%s' +lblConceded=has conceded +lblLostTryingToDrawCardsFromEmptyLibrary=has lost trying to draw cards from empty library +lblLostBecauseLifeTotalReachedZero=has lost because life total reached 0 +lblLostBecauseOfObtainingTenPoisonCounters=has lost because of obtaining 10 poison counters +lblLostBecauseAnOpponentHasWonBySpell=has lost because an opponent has won by spell '%s' +lblLostDueToEffectOfSpell=has lost due to effect of spell '%s' +lblLostDueToAccumulationOf21DamageFromGenerals=has lost due to accumulation of 21 damage from generals +lblAcceptedThatTheGameIsADraw=has accepted that the game is a draw +lblLostForUnknownReasonBug=has lost for unknown reason (this is a bug) +#ViewWinLose.java +btnNextGame=Next Game +btnStartNewMatch=Start New Match +btnQuitMatch=Quit Match +lblItsADraw=It's a draw! +lblTeamWon=Team %s won! +lblWinnerWon=%s won! +lblGameLog=Game Log \ No newline at end of file diff --git a/forge-gui/res/languages/es-ES.properties b/forge-gui/res/languages/es-ES.properties index 6321ab16982..468a4ac6480 100644 --- a/forge-gui/res/languages/es-ES.properties +++ b/forge-gui/res/languages/es-ES.properties @@ -983,9 +983,9 @@ lblCollection=Colección lblCommanders=Commanders lblOathbreakers=Oathbreakers #Forge.java -lblLoadingFonts=Loading fonts... -lblLoadingCardTranslations=Loading card translations... -lblFinishingStartup=Finishing startup... +lblLoadingFonts=Cargando fuentes... +lblLoadingCardTranslations=Cargando traducciones de cartas... +lblFinishingStartup=Finalizando el arranque... #LobbyScreen.java lblMore=Más... lblLoadingNewGame=Cargando nueva partida... @@ -1139,4 +1139,36 @@ lblCardsToPutOnTheBottom=Cartas para poner en la parte inferior lblArrangeCardsToBePutOnTopOfYourLibrary=Organizar las cartas para colocarlas en la parte superior de la biblioteca lblTopOfLibrary=Parte Superior de la Biblioteca lblSelectCardsToBePutIntoTheGraveyard=Selecciona las cartas para ponerlas en el Cementerio -lblCardsToPutInTheGraveyard=Cartas para poner en el Cementerio \ No newline at end of file +lblCardsToPutInTheGraveyard=Cartas para poner en el Cementerio +#AbstractGuiGame.java +lblConcedeCurrentGame=Esto concederá la partida actual y perderás.\n\n¿Conceder de todos modos? +lblConcedeTitle=¿Conceder Partida? +lblConcede=Conceder +lblCloseGameSpectator=Esto cerrará la partida y no podrás volver a verla.\n\n¿Cerrar de todos modos? +lblCloseGame=¿Cerrar Partida? +lblWaitingForOpponent=Esperando al oponente... +lblYieldingUntilEndOfTurn=Cediendo hasta el final del turno.\nPuedes cancelar esta cesión para realizar una acción. +lblStopWatching=Dejar de Observar +lblEnterNumberBetweenMinAndMax=Introduce un número entre %min y %max: +lblEnterNumberGreaterThanOrEqualsToMin=Introduce un número mayor o igual a %min: +lblEnterNumberLessThanOrEqualsToMax=Introduce un número menor o igual a %max: +#PlayerOutcome.java +lblWonBecauseAllOpponentsHaveLost=ha ganado porque todos los oponentes han perdido +lblWonDueToEffectOf=ha ganado debido al efecto de '%s' +lblConceded=ha concedido +lblLostTryingToDrawCardsFromEmptyLibrary=ha perdido intentando robar cartas de una biblioteca vacía +lblLostBecauseLifeTotalReachedZero=ha perdido porque el total de la vida llegó a 0 +lblLostBecauseOfObtainingTenPoisonCounters=ha perdido debido a la obtención de 10 contadores de veneno +lblLostBecauseAnOpponentHasWonBySpell=ha perdido porque un oponente ha ganado por el hechizo '%s' +lblLostDueToEffectOfSpell=ha perdido debido al efecto del hechizo '%s' +lblLostDueToAccumulationOf21DamageFromGenerals=ha perdido debido a la acumulación de 21 de daño de los generales +lblAcceptedThatTheGameIsADraw=ha aceptado que la partida es un empate +lblLostForUnknownReasonBug=ha perdido por una razón desconocida (esto es un error) +#ViewWinLose.java +btnNextGame=Siguiente Juego +btnStartNewMatch=Iniciar Nueva Partida +btnQuitMatch=Salir de la Partida +lblItsADraw=¡Es un empate! +lblTeamWon=¡El equipo %s ha ganado! +lblWinnerWon=¡%s ha ganado! +lblGameLog=Registro del Juego \ No newline at end of file diff --git a/forge-gui/res/languages/zh-CN.properties b/forge-gui/res/languages/zh-CN.properties index 058f8c77e09..c48ec9cd846 100644 --- a/forge-gui/res/languages/zh-CN.properties +++ b/forge-gui/res/languages/zh-CN.properties @@ -1139,4 +1139,36 @@ lblCardsToPutOnTheBottom=放到底部的牌张 lblArrangeCardsToBePutOnTopOfYourLibrary=为放于牌库顶的牌张排序 lblTopOfLibrary=牌库顶 lblSelectCardsToBePutIntoTheGraveyard=选择要放于坟场的牌张 -lblCardsToPutInTheGraveyard=放于坟场的牌张 \ No newline at end of file +lblCardsToPutInTheGraveyard=放于坟场的牌张 +#AbstractGuiGame.java +lblConcedeCurrentGame=This will concede the current game and you will lose.\n\nConcede anyway? +lblConcedeTitle=Concede Game? +lblConcede=Concede +lblCloseGameSpectator=This will close this game and you will not be able to resume watching it.\n\nClose anyway? +lblCloseGame=Close Game? +lblWaitingForOpponent=Waiting for opponent... +lblYieldingUntilEndOfTurn=Yielding until end of turn.\nYou may cancel this yield to take an action. +lblStopWatching=Stop Watching +lblEnterNumberBetweenMinAndMax=Enter a number between %min and %max: +lblEnterNumberGreaterThanOrEqualsToMin=Enter a number greater than or equal to %min: +lblEnterNumberLessThanOrEqualsToMax=Enter a number less than or equal to %max: +#PlayerOutcome.java +lblWonBecauseAllOpponentsHaveLost=has won because all opponents have lost +lblWonDueToEffectOf=has won due to effect of '%s' +lblConceded=has conceded +lblLostTryingToDrawCardsFromEmptyLibrary=has lost trying to draw cards from empty library +lblLostBecauseLifeTotalReachedZero=has lost because life total reached 0 +lblLostBecauseOfObtainingTenPoisonCounters=has lost because of obtaining 10 poison counters +lblLostBecauseAnOpponentHasWonBySpell=has lost because an opponent has won by spell '%s' +lblLostDueToEffectOfSpell=has lost due to effect of spell '%s' +lblLostDueToAccumulationOf21DamageFromGenerals=has lost due to accumulation of 21 damage from generals +lblAcceptedThatTheGameIsADraw=has accepted that the game is a draw +lblLostForUnknownReasonBug=has lost for unknown reason (this is a bug) +#ViewWinLose.java +btnNextGame=Next Game +btnStartNewMatch=Start New Match +btnQuitMatch=Quit Match +lblItsADraw=It's a draw! +lblTeamWon=Team %s won! +lblWinnerWon=%s won! +lblGameLog=Game Log \ No newline at end of file diff --git a/forge-gui/src/main/java/forge/match/AbstractGuiGame.java b/forge-gui/src/main/java/forge/match/AbstractGuiGame.java index f9e0bb75419..c906151501c 100644 --- a/forge-gui/src/main/java/forge/match/AbstractGuiGame.java +++ b/forge-gui/src/main/java/forge/match/AbstractGuiGame.java @@ -9,6 +9,7 @@ import java.util.Set; import java.util.Timer; import java.util.TimerTask; +import forge.util.Localizer; import org.apache.commons.lang3.StringUtils; import com.google.common.collect.ImmutableList; @@ -238,7 +239,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards { return true; } if (hasLocalPlayers()) { - if (showConfirmDialog("This will concede the current game and you will lose.\n\nConcede anyway?", "Concede Game?", "Concede", "Cancel")) { + if (showConfirmDialog(Localizer.getInstance().getMessage("lblConcedeCurrentGame"), Localizer.getInstance().getMessage("lblConcedeTitle"), Localizer.getInstance().getMessage("lblConcede"), Localizer.getInstance().getMessage("lblCancel"))) { for (final IGameController c : getOriginalGameControllers()) { // Concede each player on this Gui (except mind-controlled players) c.concede(); @@ -262,7 +263,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards { return true; //if no local players or spectator, just quit } else { - if (showConfirmDialog("This will close this game and you will not be able to resume watching it.\n\nClose anyway?", "Close Game?", "Close", "Cancel")) { + if (showConfirmDialog(Localizer.getInstance().getMessage("lblCloseGameSpectator"), Localizer.getInstance().getMessage("lblCloseGame"), Localizer.getInstance().getMessage("lblClose"), Localizer.getInstance().getMessage("lblCancel"))) { IGameController controller = spectator; spectator = null; //ensure we don't prompt again, including when calling nextGameDecision below controller.nextGameDecision(NextGameDecision.QUIT); @@ -273,14 +274,14 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards { public String getConcedeCaption() { if (hasLocalPlayers()) { - return "Concede"; + return Localizer.getInstance().getMessage("lblConcede"); } - return "Stop Watching"; + return Localizer.getInstance().getMessage("lblStopWatching"); } @Override public void updateButtons(final PlayerView owner, final boolean okEnabled, final boolean cancelEnabled, final boolean focusOk) { - updateButtons(owner, "OK", "Cancel", okEnabled, cancelEnabled, focusOk); + updateButtons(owner, Localizer.getInstance().getMessage("lblOK"), Localizer.getInstance().getMessage("lblCancel"), okEnabled, cancelEnabled, focusOk); } // Auto-yield and other input-related code @@ -341,7 +342,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards { } protected final void updatePromptForAwait(final PlayerView playerView) { - showPromptMessage(playerView, "Waiting for opponent..."); + showPromptMessage(playerView, Localizer.getInstance().getMessage("lblWaitingForOpponent")); updateButtons(playerView, false, false, false); } @@ -362,7 +363,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards { if (!autoPassUntilEndOfTurn.isEmpty()) { //allow user to cancel auto-pass cancelAwaitNextInput(); //don't overwrite prompt with awaiting opponent - showPromptMessage(getCurrentPlayer(), "Yielding until end of turn.\nYou may cancel this yield to take an action."); + showPromptMessage(getCurrentPlayer(), Localizer.getInstance().getMessage("lblYieldingUntilEndOfTurn")); updateButtons(getCurrentPlayer(), false, true, false); } } @@ -540,17 +541,17 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards { } //if Other option picked, prompt for number input - String prompt = "Enter a number"; + Localizer localizer = Localizer.getInstance(); + String prompt = ""; if (min != Integer.MIN_VALUE) { if (max != Integer.MAX_VALUE) { - prompt += " between " + min + " and " + max; + prompt = localizer.getMessage("lblEnterNumberBetweenMinAndMax").replace("%min", String.valueOf(min)).replace("%max", String.valueOf(max)); } else { - prompt += " greater than or equal to " + min; + prompt = localizer.getMessage("lblEnterNumberGreaterThanOrEqualsToMin").replace("%min", String.valueOf(min)); } } else if (max != Integer.MAX_VALUE) { - prompt += " less than or equal to " + max; + prompt = localizer.getMessage("lblEnterNumberLessThanOrEqualsToMax").replace("%max", String.valueOf(max)); } - prompt += ":"; while (true) { final String str = showInputDialog(prompt, message); @@ -651,7 +652,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards { @Override public boolean showConfirmDialog(final String message, final String title, final boolean defaultYes) { - return showConfirmDialog(message, title, "Yes", "No"); + return showConfirmDialog(message, title, Localizer.getInstance().getMessage("lblYes"), Localizer.getInstance().getMessage("lblNo")); } @Override