using System; using System.Globalization; namespace CIG.Translation { public class RawFloatString : ILocalizedString { public RawFloatString(float f, int decimals, bool showTrailingZeroes) { this._float = f; this._format = ((!showTrailingZeroes) ? ("0." + new string('#', decimals)) : ("N" + ((decimals < 0) ? string.Empty : decimals.ToString(CultureInfo.InvariantCulture)))); } public override string ToString() { return string.Concat(new string[] { "[FloatString=", this._float.ToString(), ",Format=", this._format, "]" }); } public string Translate() { return this._float.ToString(this._format, Localization.CurrentCulture.Info); } private float _float; private string _format; } }