[gbrainy] Remove decimal formatting codes from localizable strings to reduce errors when localzing these strin



commit 34d99ddec674369eba2f80273990fc64364b3ab8
Author: Jordi Mas <jmas softcatala org>
Date:   Sun Mar 13 18:50:57 2011 +0100

    Remove decimal formatting codes from localizable strings to reduce errors when localzing these strings

 src/Games/Calculation/CalculationAverage.cs        |   20 +++++++++---------
 src/Games/Calculation/CalculationCloserFraction.cs |   21 ++++++++++---------
 2 files changed, 21 insertions(+), 20 deletions(-)
---
diff --git a/src/Games/Calculation/CalculationAverage.cs b/src/Games/Calculation/CalculationAverage.cs
index 07198b3..fec7405 100644
--- a/src/Games/Calculation/CalculationAverage.cs
+++ b/src/Games/Calculation/CalculationAverage.cs
@@ -45,7 +45,7 @@ namespace gbrainy.Games.Calculation
 		public override string Question {
 			get {
 				string nums = string.Empty;
-	
+
 				for (int i = 0; i < numbers.Length - 1; i++)
 					nums += numbers[i] + ", ";
 
@@ -61,9 +61,9 @@ namespace gbrainy.Games.Calculation
 		}
 
 		public override string Rationale {
-			get { 
-				return String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("The result of the operation is {0:##0.###}."), 
-					correct);				
+			get {
+				return String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("The result of the operation is {0}."),
+					correct);
 			}
 		}
 
@@ -117,12 +117,12 @@ namespace gbrainy.Games.Calculation
 				double ans;
 
 				ans = correct + random.Next (dist);
-				duplicated = false;	
+				duplicated = false;
 
 				// No repeated answers
 				for (int num = 0; num < options_next; num++)
 				{
-					// Due to decimal precission
+					// Due to decimal precision
 					if (options [num] == ans || options [num] == ans + 1 || options [num] == ans - 1) {
 						duplicated = true;
 						break;
@@ -131,14 +131,14 @@ namespace gbrainy.Games.Calculation
 
 				if (duplicated)
 					continue;
-			
+
 				options [options_next] = ans;
 				options_next++;
 			}
 
 			random_indices = new ArrayListIndicesRandom (options_cnt);
 			random_indices.Initialize ();
-		
+
 			for (int i = 0; i < options_cnt; i++)
 			{
 				if (random_indices [i] == correct_pos) {
@@ -153,7 +153,7 @@ namespace gbrainy.Games.Calculation
 			double x = DrawAreaX + 0.25, y = DrawAreaY + 0.16;
 			Container container = new Container (x, y,  1 - (x * 2), 0.6);
 			AddWidget (container);
-	
+
 			for (int i = 0; i < options_cnt; i++)
 			{
 				DrawableArea drawable_area = new DrawableArea (0.3, 0.1);
@@ -170,7 +170,7 @@ namespace gbrainy.Games.Calculation
 
 					e.Context.SetPangoLargeFontSize ();
 					e.Context.MoveTo (0.02, 0.02);
-					e.Context.ShowPangoText (String.Format ("{0}) {1:##0.###}", Answer.GetMultiOption (n) , options [indx]));
+					e.Context.ShowPangoText (String.Format ("{0}) {1}", Answer.GetMultiOption (n) , options [indx]));
 				};
 			}
 		}
diff --git a/src/Games/Calculation/CalculationCloserFraction.cs b/src/Games/Calculation/CalculationCloserFraction.cs
index 95467bd..31ee550 100644
--- a/src/Games/Calculation/CalculationCloserFraction.cs
+++ b/src/Games/Calculation/CalculationCloserFraction.cs
@@ -43,7 +43,8 @@ namespace gbrainy.Games.Calculation
 
 		public override string Question {
 			get {return String.Format (
-				ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which of the following numbers is closer to {0:##0.###}? Answer {1}, {2}, {3} or {4}."), question_num,
+				ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which of the following numbers is closer to {0}? Answer {1}, {2}, {3} or {4}."),
+				String.Format ("{0:##0.###}", question_num),
 				Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
 		}
 
@@ -51,8 +52,8 @@ namespace gbrainy.Games.Calculation
 			get {
 				int ans_idx = random_indices[which];
 
-				return String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("The result of the operation {0} / {1} is {2:##0.###}"), 
-					options[ans_idx * 2], options[(ans_idx * 2) + 1], question_num);
+				return String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("The result of the operation {0} / {1} is {2}"),
+					options[ans_idx * 2], options[(ans_idx * 2) + 1], String.Format ("{0:##0.###}", question_num));
 			}
 		}
 
@@ -84,13 +85,13 @@ namespace gbrainy.Games.Calculation
 				duplicated = false;
 				options[0 + 0] = basenum + random.Next (randnum);
 				options[0 + 1] = basenum + random.Next (randnum);
-				
+
 				options[2 + 0] = options[0 + 0] + random.Next (2);
 				options[2 + 1] = options[0 + 1] + random.Next (2);
 
 				options[(2 * 2) + 0] = options[0 + 0] - random.Next (5);
 				options[(2 * 2) + 1] = options[0 + 1] - random.Next (5);
-		
+
 				options[(3 * 2) + 0] = options[0 + 0] +  random.Next (5);
 				options[(3 * 2) + 1] = options[0 + 1] +  random.Next (5);
 
@@ -111,7 +112,7 @@ namespace gbrainy.Games.Calculation
 
 				if (duplicated)
 					continue;
-			
+
 				// No numerator = denominator (1 value)
 				if (options [0 + 0] == options [0 + 1]) continue;
 				if (options [(1 * 2) + 0] == options [(1 * 2) + 1]) continue;
@@ -126,13 +127,13 @@ namespace gbrainy.Games.Calculation
 
 				if (i < options_cnt * 2)
 					continue;
-							
+
 				done = true;
 			}
 
 			random_indices = new ArrayListIndicesRandom (4);
 			random_indices.Initialize ();
-		
+
 			which = random.Next (options_cnt);
 			ans_idx = random_indices[which];
 			question_num = options[ans_idx * 2] / options[(ans_idx * 2) + 1];
@@ -143,7 +144,7 @@ namespace gbrainy.Games.Calculation
 			double x = DrawAreaX + 0.25, y = DrawAreaY + 0.16;
 			Container container = new Container (x, y,  1 - (x * 2), 0.6);
 			AddWidget (container);
-	
+
 			for (i = 0; i < options_cnt; i++)
 			{
 				DrawableArea drawable_area = new DrawableArea (0.3, 0.1);
@@ -160,7 +161,7 @@ namespace gbrainy.Games.Calculation
 
 					e.Context.SetPangoLargeFontSize ();
 					e.Context.MoveTo (0.02, 0.02);
-					e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), Answer.GetMultiOption (n) , 
+					e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), Answer.GetMultiOption (n) ,
 						options [indx * 2] +  " / " + options [(indx  * 2) +1]));
 				};
 			}



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