Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource hacks #1492

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,14 @@ namespace Humanizer
}
public class DefaultFormatter : Humanizer.IFormatter
{
public DefaultFormatter(System.Globalization.CultureInfo culture) { }
public DefaultFormatter(string localeCode) { }
public DefaultFormatter(System.Globalization.CultureInfo culture, IResources resources) { }
public DefaultFormatter(string localeCode, IResources resources) { }
protected System.Globalization.CultureInfo Culture { get; }
public virtual string DataUnitHumanize(Humanizer.DataUnit dataUnit, double count, bool toSymbol = true) { }
public virtual string DateHumanize(Humanizer.TimeUnit timeUnit, Humanizer.Tense timeUnitTense, int unit) { }
public virtual string DateHumanize_Never() { }
public virtual string DateHumanize_Now() { }
protected virtual string Format(string resourceKey) { }
protected virtual string Format(Humanizer.TimeUnit unit, string resourceKey, int number, bool toWords = false) { }
protected virtual string GetResourceKey(string resourceKey) { }
protected virtual string GetResourceKey(string resourceKey, int number) { }
protected virtual string NumberToWords(Humanizer.TimeUnit unit, int number, System.Globalization.CultureInfo culture) { }
public virtual string TimeSpanHumanize(Humanizer.TimeUnit timeUnit, int unit, bool toWords = false) { }
Expand Down Expand Up @@ -1174,13 +1172,10 @@ namespace Humanizer
{
public static string GetResourceKey(Humanizer.TimeUnit unit, int count = 1, bool toWords = false) { }
}
public static class TimeUnitSymbol
{
public static string GetResourceKey(Humanizer.TimeUnit unit) { }
}
}
public static class Resources
{
public static readonly System.Resources.ResourceManager ResourceManager;
public static string GetResource(string resourceKey, System.Globalization.CultureInfo? culture = null) { }
public static bool TryGetResource(string resourceKey, System.Globalization.CultureInfo? culture, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out string? result) { }
}
Expand Down Expand Up @@ -1294,4 +1289,194 @@ namespace Humanizer
Abbreviation = 1,
Eifeler = 2,
}
}
public interface IResources
{
string Culture { get; }
string DataUnitBit { get; }
string DataUnitBitSymbol { get; }
string DataUnitByte { get; }
string DataUnitByteSymbol { get; }
string DataUnitGigabyte { get; }
string DataUnitGigabyteSymbol { get; }
string DataUnitKilobyte { get; }
string DataUnitKilobyteSymbol { get; }
string DataUnitMegabyte { get; }
string DataUnitMegabyteSymbol { get; }
string DataUnitTerabyte { get; }
string DataUnitTerabyteSymbol { get; }
string DateMultipleDaysAgo { get; }
string DateMultipleDaysAgoDual { get; }
string DateMultipleDaysAgoPaucal { get; }
string DateMultipleDaysAgoPlural { get; }
string DateMultipleDaysAgoSingular { get; }
string DateMultipleDaysFromNow { get; }
string DateMultipleDaysFromNowDual { get; }
string DateMultipleDaysFromNowPaucal { get; }
string DateMultipleDaysFromNowPlural { get; }
string DateMultipleDaysFromNowSingular { get; }
string DateMultipleHoursAgo { get; }
string DateMultipleHoursAgoDual { get; }
string DateMultipleHoursAgoPaucal { get; }
string DateMultipleHoursAgoPlural { get; }
string DateMultipleHoursAgoSingular { get; }
string DateMultipleHoursFromNow { get; }
string DateMultipleHoursFromNowDual { get; }
string DateMultipleHoursFromNowPaucal { get; }
string DateMultipleHoursFromNowPlural { get; }
string DateMultipleHoursFromNowSingular { get; }
string DateMultipleMinutesAgo { get; }
string DateMultipleMinutesAgoDual { get; }
string DateMultipleMinutesAgoPaucal { get; }
string DateMultipleMinutesAgoPlural { get; }
string DateMultipleMinutesAgoSingular { get; }
string DateMultipleMinutesFromNow { get; }
string DateMultipleMinutesFromNowDual { get; }
string DateMultipleMinutesFromNowPaucal { get; }
string DateMultipleMinutesFromNowPlural { get; }
string DateMultipleMinutesFromNowSingular { get; }
string DateMultipleMonthsAgo { get; }
string DateMultipleMonthsAgoDual { get; }
string DateMultipleMonthsAgoPaucal { get; }
string DateMultipleMonthsAgoPlural { get; }
string DateMultipleMonthsAgoSingular { get; }
string DateMultipleMonthsFromNow { get; }
string DateMultipleMonthsFromNowDual { get; }
string DateMultipleMonthsFromNowPaucal { get; }
string DateMultipleMonthsFromNowPlural { get; }
string DateMultipleMonthsFromNowSingular { get; }
string DateMultipleSecondsAgo { get; }
string DateMultipleSecondsAgoDual { get; }
string DateMultipleSecondsAgoPaucal { get; }
string DateMultipleSecondsAgoPlural { get; }
string DateMultipleSecondsAgoSingular { get; }
string DateMultipleSecondsFromNow { get; }
string DateMultipleSecondsFromNowDual { get; }
string DateMultipleSecondsFromNowPaucal { get; }
string DateMultipleSecondsFromNowPlural { get; }
string DateMultipleSecondsFromNowSingular { get; }
string DateMultipleYearsAgo { get; }
string DateMultipleYearsAgoDual { get; }
string DateMultipleYearsAgoPaucal { get; }
string DateMultipleYearsAgoPlural { get; }
string DateMultipleYearsAgoSingular { get; }
string DateMultipleYearsFromNow { get; }
string DateMultipleYearsFromNowDual { get; }
string DateMultipleYearsFromNowPaucal { get; }
string DateMultipleYearsFromNowPlural { get; }
string DateMultipleYearsFromNowSingular { get; }
string DateNever { get; }
string DateNow { get; }
string DateSingleDayAgo { get; }
string DateSingleDayFromNow { get; }
string DateSingleHourAgo { get; }
string DateSingleHourFromNow { get; }
string DateSingleMinuteAgo { get; }
string DateSingleMinuteFromNow { get; }
string DateSingleMonthAgo { get; }
string DateSingleMonthFromNow { get; }
string DateSingleSecondAgo { get; }
string DateSingleSecondFromNow { get; }
string DateSingleYearAgo { get; }
string DateSingleYearFromNow { get; }
string DateTwoDaysAgo { get; }
string DateTwoDaysFromNow { get; }
string E { get; }
string ENE { get; }
string ENEShort { get; }
string ESE { get; }
string ESEShort { get; }
string EShort { get; }
string N { get; }
string NE { get; }
string NEShort { get; }
string NNE { get; }
string NNEShort { get; }
string NNW { get; }
string NNWShort { get; }
string NShort { get; }
string NW { get; }
string NWShort { get; }
string S { get; }
string SE { get; }
string SEShort { get; }
string SSE { get; }
string SSEShort { get; }
string SSW { get; }
string SSWShort { get; }
string SShort { get; }
string SW { get; }
string SWShort { get; }
string TimeSpanAge { get; }
string TimeSpanMultipleDays { get; }
string TimeSpanMultipleDaysDual { get; }
string TimeSpanMultipleDaysPaucal { get; }
string TimeSpanMultipleDaysPlural { get; }
string TimeSpanMultipleDaysSingular { get; }
string TimeSpanMultipleHours { get; }
string TimeSpanMultipleHoursDual { get; }
string TimeSpanMultipleHoursPaucal { get; }
string TimeSpanMultipleHoursPlural { get; }
string TimeSpanMultipleHoursSingular { get; }
string TimeSpanMultipleMilliseconds { get; }
string TimeSpanMultipleMillisecondsDual { get; }
string TimeSpanMultipleMillisecondsPaucal { get; }
string TimeSpanMultipleMillisecondsPlural { get; }
string TimeSpanMultipleMillisecondsSingular { get; }
string TimeSpanMultipleMinutes { get; }
string TimeSpanMultipleMinutesDual { get; }
string TimeSpanMultipleMinutesPaucal { get; }
string TimeSpanMultipleMinutesPlural { get; }
string TimeSpanMultipleMinutesSingular { get; }
string TimeSpanMultipleMonths { get; }
string TimeSpanMultipleMonthsDual { get; }
string TimeSpanMultipleMonthsPaucal { get; }
string TimeSpanMultipleMonthsPlural { get; }
string TimeSpanMultipleMonthsSingular { get; }
string TimeSpanMultipleSeconds { get; }
string TimeSpanMultipleSecondsDual { get; }
string TimeSpanMultipleSecondsPaucal { get; }
string TimeSpanMultipleSecondsPlural { get; }
string TimeSpanMultipleSecondsSingular { get; }
string TimeSpanMultipleWeeks { get; }
string TimeSpanMultipleWeeksDual { get; }
string TimeSpanMultipleWeeksPaucal { get; }
string TimeSpanMultipleWeeksPlural { get; }
string TimeSpanMultipleWeeksSingular { get; }
string TimeSpanMultipleYears { get; }
string TimeSpanMultipleYearsDual { get; }
string TimeSpanMultipleYearsPaucal { get; }
string TimeSpanMultipleYearsPlural { get; }
string TimeSpanMultipleYearsSingular { get; }
string TimeSpanSingleDay { get; }
string TimeSpanSingleDayWords { get; }
string TimeSpanSingleHour { get; }
string TimeSpanSingleHourWords { get; }
string TimeSpanSingleMillisecond { get; }
string TimeSpanSingleMillisecondWords { get; }
string TimeSpanSingleMinute { get; }
string TimeSpanSingleMinuteWords { get; }
string TimeSpanSingleMonth { get; }
string TimeSpanSingleMonthWords { get; }
string TimeSpanSingleSecond { get; }
string TimeSpanSingleSecondWords { get; }
string TimeSpanSingleWeek { get; }
string TimeSpanSingleWeekWords { get; }
string TimeSpanSingleYear { get; }
string TimeSpanSingleYearWords { get; }
string TimeSpanZero { get; }
string TimeUnitDay { get; }
string TimeUnitHour { get; }
string TimeUnitMillisecond { get; }
string TimeUnitMinute { get; }
string TimeUnitMonth { get; }
string TimeUnitSecond { get; }
string TimeUnitWeek { get; }
string TimeUnitYear { get; }
string W { get; }
string WNW { get; }
string WNWShort { get; }
string WSW { get; }
string WSWShort { get; }
string WShort { get; }
}
6 changes: 4 additions & 2 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net48</TargetFrameworks>
<TargetFrameworks>net48</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
<PackageReference Include="System.Resources.Reader" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7" PrivateAssets="all" />
<PackageReference Include="Verify.Xunit" Version="23.5.2" />
<PackageReference Include="Verify.Xunit" Version="23.6.0" />
<PackageReference Include="Verify.DiffPlex" Version="2.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<ProjectReference Include="..\Humanizer\Humanizer.csproj" />
<Reference Include="System.ComponentModel.DataAnnotations" Condition="'$(TargetFramework)' == 'net48' " />
<Content Include="xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Reference Include="System.Windows.Forms" />
</ItemGroup>

</Project>
Loading
Loading