translate desktop sideboard dialog message

This commit is contained in:
CCTV-1
2020-02-25 12:24:22 +08:00
parent f3d739a5d8
commit 82e520ca67
3 changed files with 15 additions and 15 deletions

View File

@@ -241,9 +241,8 @@ public class Match {
person = sideboardProxy; person = sideboardProxy;
} }
String forPlayer = " for " + player.getName();
Deck toChange = psc.getDeck(); Deck toChange = psc.getDeck();
List<PaperCard> newMain = person.sideboard(toChange, rules.getGameType(), forPlayer); List<PaperCard> newMain = person.sideboard(toChange, rules.getGameType(), player.getName());
if (null != newMain) { if (null != newMain) {
CardPool allCards = new CardPool(); CardPool allCards = new CardPool();
allCards.addAll(toChange.get(DeckSection.Main)); allCards.addAll(toChange.get(DeckSection.Main));

View File

@@ -30,6 +30,7 @@ import forge.model.FModel;
import forge.screens.match.CMatchUI; import forge.screens.match.CMatchUI;
import forge.toolbox.FOptionPane; import forge.toolbox.FOptionPane;
import forge.view.arcane.ListCardArea; import forge.view.arcane.ListCardArea;
import forge.util.Localizer;
public class GuiChoose { public class GuiChoose {
@@ -83,6 +84,7 @@ public class GuiChoose {
return GuiChoose.oneOrNone(message, choices); return GuiChoose.oneOrNone(message, choices);
} }
public static Integer getInteger(final String message, final int min, final int max, final int cutoff) { public static Integer getInteger(final String message, final int min, final int max, final int cutoff) {
final Localizer localizer = Localizer.getInstance();
if (max <= min || cutoff < min) { return min; } //just return min if max <= min or cutoff < min if (max <= min || cutoff < min) { return min; } //just return min if max <= min or cutoff < min
if (cutoff >= max) { //fallback to regular integer prompt if cutoff at or after max if (cutoff >= max) { //fallback to regular integer prompt if cutoff at or after max
@@ -93,7 +95,7 @@ public class GuiChoose {
for (int i = min; i <= cutoff; i++) { for (int i = min; i <= cutoff; i++) {
choices.add(Integer.valueOf(i)); choices.add(Integer.valueOf(i));
} }
choices.add("Other..."); choices.add(Localizer.getInstance().getMessage("lblOtherInteger"));
final Object choice = GuiChoose.oneOrNone(message, choices); final Object choice = GuiChoose.oneOrNone(message, choices);
if (choice instanceof Integer || choice == null) { if (choice instanceof Integer || choice == null) {
@@ -101,19 +103,18 @@ public class GuiChoose {
} }
//if Other option picked, prompt for number input //if Other option picked, prompt for number input
String prompt = "Enter a number"; String prompt = "";
if (min != Integer.MIN_VALUE) { if (min != Integer.MIN_VALUE) {
if (max != Integer.MAX_VALUE) { if (max != Integer.MAX_VALUE) {
prompt += " between " + min + " and " + max; prompt = localizer.getMessage("lblEnterNumberBetweenMinAndMax", String.valueOf(min), String.valueOf(max));
} }
else { else {
prompt += " greater than or equal to " + min; prompt = localizer.getMessage("lblEnterNumberGreaterThanOrEqualsToMin", String.valueOf(min));
} }
} }
else if (max != Integer.MAX_VALUE) { else if (max != Integer.MAX_VALUE) {
prompt += " less than or equal to " + max; prompt = localizer.getMessage("lblEnterNumberLessThanOrEqualsToMax", String.valueOf(max));
} }
prompt += ":";
while (true) { while (true) {
final String str = FOptionPane.showInputDialog(prompt, message); final String str = FOptionPane.showInputDialog(prompt, message);
@@ -237,7 +238,7 @@ public class GuiChoose {
public static <T extends Comparable<? super T>> List<T> sideboard(final CMatchUI matchUI, final List<T> sideboard, final List<T> deck, final String message) { public static <T extends Comparable<? super T>> List<T> sideboard(final CMatchUI matchUI, final List<T> sideboard, final List<T> deck, final String message) {
Collections.sort(deck); Collections.sort(deck);
Collections.sort(sideboard); Collections.sort(sideboard);
return order("Sideboard" + message, "Main Deck", -1, -1, sideboard, deck, null, true, matchUI); return order(Localizer.getInstance().getMessage("lblSideboardForPlayer", message), Localizer.getInstance().getMessage("ttMain"), -1, -1, sideboard, deck, null, true, matchUI);
} }
public static <T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax, public static <T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
@@ -303,8 +304,8 @@ public class GuiChoose {
FThreads.invokeInEdtAndWait(ft); FThreads.invokeInEdtAndWait(ft);
gui.clearSelectables(); gui.clearSelectables();
try { try {
List<CardView> result = ft.get(); List<CardView> result = ft.get();
return result; return result;
} catch (final Exception e) { // we have waited enough } catch (final Exception e) { // we have waited enough
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -569,7 +569,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
for (int i = min; i <= cutoff; i++) { for (int i = min; i <= cutoff; i++) {
choices.add(Integer.valueOf(i)); choices.add(Integer.valueOf(i));
} }
choices.add("..."); choices.add(Localizer.getInstance().getMessage("lblOtherInteger"));
final Object choice = oneOrNone(message, choices.build()); final Object choice = oneOrNone(message, choices.build());
if (choice instanceof Integer || choice == null) { if (choice instanceof Integer || choice == null) {
@@ -581,12 +581,12 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
String prompt = ""; String prompt = "";
if (min != Integer.MIN_VALUE) { if (min != Integer.MIN_VALUE) {
if (max != Integer.MAX_VALUE) { if (max != Integer.MAX_VALUE) {
prompt = localizer.getMessage("lblEnterNumberBetweenMinAndMax").replace("%min", String.valueOf(min)).replace("%max", String.valueOf(max)); prompt = localizer.getMessage("lblEnterNumberBetweenMinAndMax", String.valueOf(min), String.valueOf(max));
} else { } else {
prompt = localizer.getMessage("lblEnterNumberGreaterThanOrEqualsToMin").replace("%min", String.valueOf(min)); prompt = localizer.getMessage("lblEnterNumberGreaterThanOrEqualsToMin", String.valueOf(min));
} }
} else if (max != Integer.MAX_VALUE) { } else if (max != Integer.MAX_VALUE) {
prompt = localizer.getMessage("lblEnterNumberLessThanOrEqualsToMax").replace("%max", String.valueOf(max)); prompt = localizer.getMessage("lblEnterNumberLessThanOrEqualsToMax", String.valueOf(max));
} }
while (true) { while (true) {