comparison 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
comparison
equal deleted inserted replaced
213:c6713a1b4c0d 214:1b718b67f7f6
9 using System.Xml; 9 using System.Xml;
10 using System.Xml.Schema; 10 using System.Xml.Schema;
11 using IBBoard.Lang; 11 using IBBoard.Lang;
12 using IBBoard.Xml; 12 using IBBoard.Xml;
13 using IBBoard.WarFoundry.API.Objects; 13 using IBBoard.WarFoundry.API.Objects;
14 using IBBoard.WarFoundry.API.Util;
14 15
15 namespace IBBoard.WarFoundry.API.Exporters 16 namespace IBBoard.WarFoundry.API.Exporters
16 { 17 {
17 /// <summary> 18 /// <summary>
18 /// Custom exporter that exports an army as a basic HTML file 19 /// Custom exporter that exports an army as a basic HTML file
157 } 158 }
158 else 159 else
159 { 160 {
160 sb.Append(", "); 161 sb.Append(", ");
161 } 162 }
162 163
163 sb.Append(Translation.GetTranslation("armyHtmlExportEquipAmountRatio", "{0} for {1}", equip.Name, unit.GetEquipmentAmountString(equip))); 164 string amountString;
165 double amount = UnitEquipmentUtil.GetEquipmentAmount(unit, equip);
166
167 if (UnitEquipmentUtil.GetEquipmentAmountIsRatio(unit, equip))
168 {
169 int number = UnitEquipmentUtil.GetEquipmentAmountTaken(unit, equip);
170
171 if (amount == 100)
172 {
173 amountString = Translation.GetTranslation("armyHtmlExportEquipAmountAll", "all ({1})", amount, number);
174 }
175 else
176 {
177 amountString = Translation.GetTranslation("armyHtmlExportEquipAmountPercentage", "{0}% ({1})", amount, number);
178 }
179 }
180 else
181 {
182 amountString = amount.ToString();
183 }
184
185 sb.Append(Translation.GetTranslation("armyHtmlExportEquipAmountRatio", "{0} for {1}", equip.Name, amountString));
164 } 186 }
165 187
166 sb.Append(". "); 188 sb.Append(". ");
167 } 189 }
168 190