|
- using System;
- using System.Globalization;
-
- namespace CIG.Translation
- {
- public class RawDoubleString : ILocalizedString
- {
- public RawDoubleString(double m, int decimals, bool showTrailingZeroes)
- {
- this._double = m;
- 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[]
- {
- "[DoubleString=",
- this._double.ToString(),
- ",Format=",
- this._format,
- "]"
- });
- }
-
- public string Translate()
- {
- return this._double.ToString(this._format, Localization.CurrentCulture.Info);
- }
-
- private double _double;
-
- private string _format;
- }
- }
|