[gbrainy] Concatenate strings in a I18N friendly way



commit e2129fbbf7cbfec1ef7af7cb50831b51a46431a7
Author: Jordi Mas <jmas softcatala org>
Date:   Wed Oct 27 21:45:40 2010 +0200

    Concatenate strings in a I18N friendly way

 .../Classical/Dialogs/PlayerHistoryDialog.cs       |   14 +++++++-----
 src/Core/Main/Game.cs                              |    5 ++-
 src/Core/Main/GameSession.cs                       |   22 ++++++++++++-------
 src/Core/Main/Verbal/Analogies.cs                  |    5 ++-
 4 files changed, 28 insertions(+), 18 deletions(-)
---
diff --git a/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs b/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
index 105b379..d4b00f9 100644
--- a/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
+++ b/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
@@ -40,22 +40,24 @@ namespace gbrainy.Clients.Classical
 
 		public PlayerHistoryDialog (PlayerHistory history) : base ("PlayerHistoryDialog.ui", "playerhistory")
 		{
-			string label;
+			string intro, built;
 
-			label = Catalog.GetString ("The graph below shows the player's game score evolution.") + " ";
+			intro = Catalog.GetString ("The graph below shows the player's game score evolution.");
 
 			if (history.Games.Count < 2)
 			{
-				label += Catalog.GetString ("You need more than one game session recorded to see the score evolution.");
+				built = Catalog.GetString ("You need more than one game session recorded to see the score evolution.");
 			}
 			else 
 			{
-				label +=  Catalog.GetPluralString ("It is built using the results of {0} recorded game session.",
+				built =  String.Format (Catalog.GetPluralString ("It is built using the results of {0} recorded game session.",
 					"It is built using the results of the last {0} recorded game sessions.",
-					history.Games.Count);
+					history.Games.Count),
+					history.Games.Count);	
 			}
 
-			label_playerhistory.Text = String.Format (label, history.Games.Count);
+			// Translators: "The graph below" +  "It is built using" sentences
+			label_playerhistory.Text = String.Format (Catalog.GetString ("{0} {1}"), intro, built);
 
 			drawing_area = new CairoPreview (history);
 			history_preview.Add (drawing_area);
diff --git a/src/Core/Main/Game.cs b/src/Core/Main/Game.cs
index 465f213..eec8568 100644
--- a/src/Core/Main/Game.cs
+++ b/src/Core/Main/Game.cs
@@ -152,8 +152,9 @@ namespace gbrainy.Core.Main
 
 				if (String.IsNullOrEmpty (Rationale))
 					return str;
-
-				return str + " " + Rationale;
+				
+				// Translators: answer + rationale of the answer
+				return String.Format (Catalog.GetString ("{0} {1}"), str, Rationale);
 			}
 		}
 
diff --git a/src/Core/Main/GameSession.cs b/src/Core/Main/GameSession.cs
index a3322fe..b0790a0 100644
--- a/src/Core/Main/GameSession.cs
+++ b/src/Core/Main/GameSession.cs
@@ -172,14 +172,20 @@ namespace gbrainy.Core.Main
 				if (Status == SessionStatus.NotPlaying)
 					return string.Empty;
 
-				String text;
-				text = String.Format (Catalog.GetString ("Games played: {0} (Score: {1})"), history.GamesPlayed, history.TotalScore);
-				text += String.Format (Catalog.GetString (" - Time: {0}"), current_time);
-
-				if (CurrentGame != null)
-	 				text += " " + String.Format (Catalog.GetString ("- Game: {0}"), CurrentGame.Name);
-	
-				return text;
+				string played, time, game;
+
+				played = String.Format (Catalog.GetString ("Games played: {0} (Score: {1})"), history.GamesPlayed, history.TotalScore);
+				time = String.Format (Catalog.GetString ("Time: {0}"), current_time);
+
+				if (CurrentGame != null) {
+					// Translators: {0} is the name of the game
+	 				game = String.Format (Catalog.GetString ("Game: {0}"), CurrentGame.Name);
+					// Translators: text in the status bar: games played - time - game name
+					return String.Format (Catalog.GetString ("{0} - {1} - {2}"), played, time, game);
+				} else {
+					// Translators: text in the status bar: games played - time
+					return String.Format (Catalog.GetString ("{0} - {1}"), played, time);
+				}	
 			}
 		}
 
diff --git a/src/Core/Main/Verbal/Analogies.cs b/src/Core/Main/Verbal/Analogies.cs
index cd4ad46..817fad3 100644
--- a/src/Core/Main/Verbal/Analogies.cs
+++ b/src/Core/Main/Verbal/Analogies.cs
@@ -57,8 +57,9 @@ namespace gbrainy.Core.Main.Verbal
 
 				if (String.IsNullOrEmpty (Rationale))
 					return str;
-
-				return str += " " + Rationale;
+				
+				// Translators: answer + rationale of the answer
+				return  String.Format (Catalog.GetString ("{0} {1}"), str, Rationale);
 			}
 		}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]