Mercurial > repos > IBBoard.WarFoundry.API
diff api/Commands/SetNameCommand.cs @ 215:391446c9b250
Re #223: Use translations within the API
* Translate and cache undo/redo descriptions of commands
* Simplify "set equipment amount" descriptions because of ticket:224
Also:
* Line ending change on ICostedWarFoundryObject
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 22 Nov 2009 20:08:45 +0000 |
parents | 2f3cafb69799 |
children | 650bbe79b884 |
line wrap: on
line diff
--- a/api/Commands/SetNameCommand.cs Sat Nov 21 21:27:07 2009 +0000 +++ b/api/Commands/SetNameCommand.cs Sun Nov 22 20:08:45 2009 +0000 @@ -4,6 +4,7 @@ using System; using IBBoard.Commands; +using IBBoard.Lang; using IBBoard.WarFoundry.API.Objects; namespace IBBoard.WarFoundry.API.Commands @@ -15,6 +16,8 @@ { private WarFoundryObject obj; private string newName, oldName; + private string description; + private string undoDescription; public SetNameCommand(WarFoundryObject toRename, string name) { @@ -30,12 +33,28 @@ public override string Description { - get { return "Rename "+oldName; } + get + { + if (description == null) + { + description = Translation.GetTranslation("setUnitNameCommandDescription", "rename \"{0}\" to \"{1}\"", oldName, newName); + } + + return description; + } } public override string UndoDescription { - get { return "Revert name of "+newName; } + get + { + if (undoDescription == null) + { + undoDescription = Translation.GetTranslation("setUnitNameCommandUndoDescription", "rename \"{0}\" to \"{1}\"", newName, oldName); + } + + return undoDescription; + } } public override bool Execute()