Make UI text translatable in MagicFromCardFilterChoice.

master
lodici 2017-02-22 18:05:58 +00:00
parent 1d5e298f72
commit 52edb2f0f2
1 changed files with 11 additions and 4 deletions

View File

@ -15,9 +15,16 @@ import magic.model.MagicPlayer;
import magic.model.MagicSource;
import magic.model.event.MagicEvent;
import magic.model.target.MagicTargetFilter;
import magic.translate.MText;
public class MagicFromCardFilterChoice extends MagicChoice {
// translatable UI text (prefix with _S).
private static final String _S1 = "Choose up to 1 card";
private static final String _S2 = "Choose up to %d cards";
private static final String _S3 = "Choose a card";
private static final String _S4 = "Choose %d cards";
private final MagicTargetFilter<MagicCard> filter;
private final int amount;
private final boolean upTo;
@ -33,13 +40,13 @@ public class MagicFromCardFilterChoice extends MagicChoice {
final String paddedDesc = description.isEmpty() ? description : " " + description;
if (aUpTo && amount == 1) {
return "Choose up to 1 card" + paddedDesc + ".";
return _S1 + paddedDesc + ".";
} else if (aUpTo && amount != 1) {
return "Choose up to " + amount + " cards" + paddedDesc + ".";
return MText.get(_S2, amount) + paddedDesc + ".";
} else if (!aUpTo && amount == 1) {
return "Choose a card" + paddedDesc + ".";
return _S3 + paddedDesc + ".";
} else {
return "Choose " + amount + " cards" + paddedDesc + ".";
return MText.get(_S4, amount) + paddedDesc + ".";
}
}