/
IFormatter.cs
62 lines (56 loc) · 2.39 KB
/
IFormatter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
namespace Humanizer.Localisation.Formatters
{
/// <summary>
/// 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 يوم
/// </summary>
public interface IFormatter
{
/// <summary>
/// Now
/// </summary>
/// <returns>Returns Now</returns>
string DateHumanize_Now();
/// <summary>
/// Never
/// </summary>
/// <returns>Returns Never</returns>
string DateHumanize_Never();
/// <summary>
/// Returns the string representation of the provided DateTime
/// </summary>
/// <param name="timeUnit"></param>
/// <param name="timeUnitTense"></param>
/// <param name="unit"></param>
/// <returns></returns>
string DateHumanize(TimeUnit timeUnit, Tense timeUnitTense, int unit);
/// <summary>
/// 0 seconds
/// </summary>
/// <returns>Returns 0 seconds as the string representation of Zero TimeSpan</returns>
string TimeSpanHumanize_Zero();
/// <summary>
/// Returns the string representation of the provided TimeSpan
/// </summary>
/// <param name="timeUnit"></param>
/// <param name="unit"></param>
/// <param name="toWords"></param>
/// <returns></returns>
string TimeSpanHumanize(TimeUnit timeUnit, int unit, bool toWords = false);
/// <summary>
/// Returns the string representation of the provided DataUnit, either as a symbol or full word
/// </summary>
/// <param name="dataUnit">Data unit</param>
/// <param name="count">Number of said units, to adjust for singular/plural forms</param>
/// <param name="toSymbol">Indicates whether the data unit should be expressed as symbol or full word</param>
/// <returns>String representation of the provided DataUnit</returns>
string DataUnitHumanize(DataUnit dataUnit, double count, bool toSymbol = true);
/// <summary>
/// Returns the symbol for the given TimeUnit
/// </summary>
/// <param name="timeUnit">Time unit</param>
/// <returns>String representation of the provided TimeUnit</returns>
string TimeUnitHumanize(TimeUnit timeUnit);
}
}