diff api/Exporters/WarFoundryHtmlExporter.cs @ 214:1b718b67f7f6

Re #179: Make sure that translations are used throughout UI * Fix locations in the API that are used in the front-end
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Nov 2009 21:27:07 +0000
parents e8e9026dd4ea
children 65553d2c8612
line wrap: on
line diff
--- a/api/Exporters/WarFoundryHtmlExporter.cs	Sat Nov 21 20:06:36 2009 +0000
+++ b/api/Exporters/WarFoundryHtmlExporter.cs	Sat Nov 21 21:27:07 2009 +0000
@@ -10,7 +10,8 @@
 using System.Xml.Schema;
 using IBBoard.Lang;
 using IBBoard.Xml;
-using IBBoard.WarFoundry.API.Objects;
+using IBBoard.WarFoundry.API.Objects;
+using IBBoard.WarFoundry.API.Util;
 
 namespace IBBoard.WarFoundry.API.Exporters
 {
@@ -158,9 +159,30 @@
 					else
 					{
 						sb.Append(", ");
-					}
-	
-					sb.Append(Translation.GetTranslation("armyHtmlExportEquipAmountRatio", "{0} for {1}", equip.Name, unit.GetEquipmentAmountString(equip)));
+					}
+
+					string amountString;
+					double amount = UnitEquipmentUtil.GetEquipmentAmount(unit, equip);
+
+					if (UnitEquipmentUtil.GetEquipmentAmountIsRatio(unit, equip))
+					{
+						int number = UnitEquipmentUtil.GetEquipmentAmountTaken(unit, equip);
+
+						if (amount == 100)
+						{
+							amountString = Translation.GetTranslation("armyHtmlExportEquipAmountAll", "all ({1})", amount, number);
+						}
+						else
+						{
+							amountString = Translation.GetTranslation("armyHtmlExportEquipAmountPercentage", "{0}% ({1})", amount, number);
+						}
+					}
+					else
+					{
+						amountString = amount.ToString();
+					}
+
+					sb.Append(Translation.GetTranslation("armyHtmlExportEquipAmountRatio", "{0} for {1}", equip.Name, amountString));
 				}
 				
 				sb.Append(". ");