Humanizer.Localisation.Formatters.IFormatter
IFormatter Interface
Implement this interface if your language has complex rules around dealing with numbers. For example in Romanian "5 days" is "5 zile", while "24 days" is "24 de zile" and in Arabic 2 days is يومين not 2 يوم
public interface IFormatter
Derived
↳ DefaultFormatter
Methods
IFormatter.DataUnitHumanize(DataUnit, double, bool) Method
Returns the string representation of the provided DataUnit, either as a symbol or full word
string DataUnitHumanize(Humanizer.Localisation.DataUnit dataUnit, double count, bool toSymbol=true);
Parameters
dataUnit DataUnit
Data unit
count System.Double
Number of said units, to adjust for singular/plural forms
toSymbol System.Boolean
Indicates whether the data unit should be expressed as symbol or full word
Returns
System.String
String representation of the provided DataUnit
IFormatter.DateHumanize(TimeUnit, Tense, int) Method
Returns the string representation of the provided DateTime
string DateHumanize(Humanizer.Localisation.TimeUnit timeUnit, Humanizer.Localisation.Tense timeUnitTense, int unit);
Parameters
timeUnit TimeUnit
timeUnitTense Tense
unit System.Int32
Returns
IFormatter.DateHumanize_Never() Method
Never
string DateHumanize_Never();
Returns
System.String
Returns Never
IFormatter.DateHumanize_Now() Method
Now
string DateHumanize_Now();
Returns
System.String
Returns Now
IFormatter.TimeSpanHumanize(TimeUnit, int, bool) Method
Returns the string representation of the provided TimeSpan
string TimeSpanHumanize(Humanizer.Localisation.TimeUnit timeUnit, int unit, bool toWords=false);
Parameters
timeUnit TimeUnit
unit System.Int32
toWords System.Boolean
Returns
IFormatter.TimeSpanHumanize_Zero() Method
0 seconds
string TimeSpanHumanize_Zero();
Returns
System.String
Returns 0 seconds as the string representation of Zero TimeSpan
IFormatter.TimeUnitHumanize(TimeUnit) Method
Returns the symbol for the given TimeUnit
string TimeUnitHumanize(Humanizer.Localisation.TimeUnit timeUnit);
Parameters
timeUnit TimeUnit
Time unit
Returns
System.String
String representation of the provided TimeUnit