|
From: <bur...@us...> - 2012-01-21 11:11:27
|
Revision: 9569
http://freecol.svn.sourceforge.net/freecol/?rev=9569&view=rev
Author: burschik
Date: 2012-01-21 11:11:20 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
Remove lego from tutorial.start message.
Modified Paths:
--------------
freecol/trunk/data/strings/FreeColMessages.properties
freecol/trunk/src/net/sf/freecol/client/control/PreGameController.java
freecol/trunk/src/net/sf/freecol/client/gui/i18n/Messages.java
freecol/trunk/test/src/net/sf/freecol/client/gui/i18n/MessagesTest.java
Modified: freecol/trunk/data/strings/FreeColMessages.properties
===================================================================
--- freecol/trunk/data/strings/FreeColMessages.properties 2012-01-21 10:33:40 UTC (rev 9568)
+++ freecol/trunk/data/strings/FreeColMessages.properties 2012-01-21 11:11:20 UTC (rev 9569)
@@ -240,7 +240,7 @@
EventPanel.MEETING_AZTEC=You meet the Aztec nation.
EventPanel.MEETING_INCA=You meet the Inca nation.
-tutorial.startGame=After months at sea, you have finally arrived off the coast of an unknown continent. Sail %direction% in order to discover the New World and to claim it for the Crown.
+tutorial.startGame=After months at sea, you have finally arrived off the coast of an unknown continent. Sail {{tag:%direction%|west=westward|east=eastward|default=into the wind}} in order to discover the New World and to claim it for the Crown.
tutorial.buildColony=Try building a Colony by pushing the key %build_colony_key% or choosing %build_colony_menu_item% from the %orders_menu_item% menu.\n\nYou will be warned if there is something negative about building the Colony at the chosen location.
Colony=Colony
Modified: freecol/trunk/src/net/sf/freecol/client/control/PreGameController.java
===================================================================
--- freecol/trunk/src/net/sf/freecol/client/control/PreGameController.java 2012-01-21 10:33:40 UTC (rev 9568)
+++ freecol/trunk/src/net/sf/freecol/client/control/PreGameController.java 2012-01-21 11:11:20 UTC (rev 9569)
@@ -236,7 +236,7 @@
new ModelMessage(ModelMessage.MessageType.TUTORIAL,
"tutorial.startGame", myPlayer);
String direction = myPlayer.getNation().startsOnEastCoast()
- ? "direction.W" : "direction.E";
+ ? "west" : "east";
message.add("%direction%", direction);
myPlayer.addModelMessage(message);
// force view of tutorial message
Modified: freecol/trunk/src/net/sf/freecol/client/gui/i18n/Messages.java
===================================================================
--- freecol/trunk/src/net/sf/freecol/client/gui/i18n/Messages.java 2012-01-21 10:33:40 UTC (rev 9568)
+++ freecol/trunk/src/net/sf/freecol/client/gui/i18n/Messages.java 2012-01-21 11:11:20 UTC (rev 9569)
@@ -344,8 +344,24 @@
otherKey = getChoice(messageBundle.get(otherKey), selector);
result.append(otherKey);
} else {
- logger.warning("Unknown key or untagged choice: " + otherKey);
- continue;
+ logger.warning("Unknown key or untagged choice: '" + otherKey
+ + "', selector was '" + selector
+ + "', trying 'default' instead");
+ int defaultStart = otherKey.indexOf("default=");
+ if (defaultStart >= 0) {
+ defaultStart += 8;
+ int defaultEnd = otherKey.indexOf('|', defaultStart);
+ String defaultChoice;
+ if (defaultEnd < 0) {
+ defaultChoice = otherKey.substring(defaultStart);
+ } else {
+ defaultChoice = otherKey.substring(defaultStart, defaultEnd);
+ }
+ result.append(defaultChoice);
+ } else {
+ logger.warning("No default choice found.");
+ continue;
+ }
}
} else {
int start = keyIndex + selector.length() + 1;
Modified: freecol/trunk/test/src/net/sf/freecol/client/gui/i18n/MessagesTest.java
===================================================================
--- freecol/trunk/test/src/net/sf/freecol/client/gui/i18n/MessagesTest.java 2012-01-21 10:33:40 UTC (rev 9568)
+++ freecol/trunk/test/src/net/sf/freecol/client/gui/i18n/MessagesTest.java 2012-01-21 11:11:20 UTC (rev 9569)
@@ -175,6 +175,31 @@
}
+ public void testReplaceArbitraryTag() {
+ StringTemplate template = StringTemplate.template("tutorial.startGame")
+ .add("%direction%", "east");
+ String expected = "After months at sea, you have finally arrived off the "
+ + "coast of an unknown continent. Sail eastward in order to discover "
+ + "the New World and to claim it for the Crown.";
+ assertEquals(expected, Messages.message(template));
+
+ template = StringTemplate.template("tutorial.startGame")
+ .add("%direction%", "west");
+ expected = "After months at sea, you have finally arrived off the "
+ + "coast of an unknown continent. Sail westward in order to discover "
+ + "the New World and to claim it for the Crown.";
+ assertEquals(expected, Messages.message(template));
+
+ template = StringTemplate.template("tutorial.startGame")
+ .add("%direction%", "whatever");
+ expected = "After months at sea, you have finally arrived off the "
+ + "coast of an unknown continent. Sail into the wind in order to discover "
+ + "the New World and to claim it for the Crown.";
+ assertEquals(expected, Messages.message(template));
+
+ }
+
+
public void testReplaceChoicesPlural() {
String mapping = "some.key=This is {{plural:%number%|one=a test|other=one of several tests"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|