# HG changeset patch # User IBBoard # Date 1258821688 0 # Node ID acaea18ac0a15c956c9f1aec16129dfc1e375ddb # Parent c7afc7824f50d1335b04f6737748b105d67f4e10 Fixes #220: Make percentage and numeric amounts more obvious * Differentiate between "free" and costed and build up a new string with more options * Make use of translations for all of the parts of the line Re #179: Make sure that translations are used throughout UI * Add new translations to file diff -r c7afc7824f50 -r acaea18ac0a1 Util/UnitEquipmentChoice.cs --- a/Util/UnitEquipmentChoice.cs Sat Nov 21 15:33:00 2009 +0000 +++ b/Util/UnitEquipmentChoice.cs Sat Nov 21 16:41:28 2009 +0000 @@ -3,9 +3,9 @@ // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. using System; +using IBBoard.Lang; using IBBoard.WarFoundry.API.Objects; - - +using IBBoard.WarFoundry.API.Util; namespace IBBoard.WarFoundry.GUI.WinForms.Util { @@ -26,19 +26,44 @@ public override string ToString() { - return String.Format("{0} (For {1} at {2}pts each)", item.Name, GetAmountString(), item.Cost); + String translation = ""; + + if (item.Cost == 0) + { + translation = Translation.GetTranslation("equipmentAmountWithZeroCost", "{0} ({1} - free)", item.Name, GetAmountString()); + } + else + { + translation = Translation.GetTranslation("equipmentAmountWithCost", "{0} ({1} at {2}pts each)", item.Name, GetAmountString(), item.Cost); + } + + return translation; } private string GetAmountString() { - if (unit.GetEquipmentAmountIsRatio(item)) + double amount = UnitEquipmentUtil.GetEquipmentAmount(unit, item); + string amountString = ""; + + if (UnitEquipmentUtil.GetEquipmentAmountIsRatio(unit, item)) { - return UnitEquipmentRatioSelection.GetEquipmentAmountString(unit.GetEquipmentAmount(item)); + int number = UnitEquipmentUtil.GetEquipmentAmountTaken(unit, item); + + if (amount == 100) + { + amountString = Translation.GetTranslation("equipmentAmountAll", "all ({1})", amount, number); + } + else + { + amountString = Translation.GetTranslation("equipmentAmountPercentage", "{0}% ({1})", amount, number); + } } else { - return UnitEquipmentNumericSelection.GetEquipmentAmountString(unit.GetEquipmentAmount(item)); + amountString = amount.ToString(); } + + return amountString; } public UnitEquipmentItem Item diff -r c7afc7824f50 -r acaea18ac0a1 translations/en.translation --- a/translations/en.translation Sat Nov 21 15:33:00 2009 +0000 +++ b/translations/en.translation Sat Nov 21 16:41:28 2009 +0000 @@ -63,6 +63,10 @@ Remove Replace Edit + {0} ({1} at {2}pts each) + {0} ({1} for free) + For all ({1}) + For {0}% ({1}) Invalid race file Invalid army file The army "{0}" has been modified.