-
Notifications
You must be signed in to change notification settings - Fork 966
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use resources to specify age & pre-hyphenated age formats
- Define default resource values (in Resources.resx) as "{0}" and "", respectively - Add Resources.en.resx and Resources.en-US.resx, to override the defaults - Add/modify nuspec files accordingly - Simplify default (en-US) tests and move tests for other English-based cultures to another file
- Loading branch information
Showing
14 changed files
with
429 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package> | ||
<metadata minClientVersion="2.12"> | ||
<id>Humanizer.Core.en-US</id> | ||
<version>$version$</version> | ||
<title>Humanizer Locale (en-US)</title> | ||
<authors>Mehdi Khalili, Claire Novotny</authors> | ||
<projectUrl>https://github.com/Humanizr/Humanizer</projectUrl> | ||
<icon>logo.png</icon> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>Humanizer Locale English (United States) (en-US)</description> | ||
<copyright>Copyright (c) .NET Foundation and Contributors</copyright> | ||
<license type="expression">MIT</license> | ||
<repository type="$RepositoryType$" url="$RepositoryUrl$" commit="$RepositoryCommit$" /> | ||
<language>en-US</language> | ||
<dependencies> | ||
<dependency id="Humanizer.Core" version="[$version$]" /> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="Humanizer\bin\Release\netstandard1.0\en-US\*.*" target="lib\netstandard1.0\en-US" /> | ||
<file src="Humanizer\bin\Release\netstandard2.0\en-US\*.*" target="lib\netstandard2.0\en-US" /> | ||
<file src="Humanizer\bin\Release\net6.0\en-US\*.*" target="lib\net6.0\en-US" /> | ||
<file src="..\logo.png" target="logo.png" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package> | ||
<metadata minClientVersion="2.12"> | ||
<id>Humanizer.Core.en</id> | ||
<version>$version$</version> | ||
<title>Humanizer Locale (en)</title> | ||
<authors>Mehdi Khalili, Claire Novotny</authors> | ||
<projectUrl>https://github.com/Humanizr/Humanizer</projectUrl> | ||
<icon>logo.png</icon> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>Humanizer Locale English (en)</description> | ||
<copyright>Copyright (c) .NET Foundation and Contributors</copyright> | ||
<license type="expression">MIT</license> | ||
<repository type="$RepositoryType$" url="$RepositoryUrl$" commit="$RepositoryCommit$" /> | ||
<language>en</language> | ||
<dependencies> | ||
<dependency id="Humanizer.Core" version="[$version$]" /> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="Humanizer\bin\Release\netstandard1.0\en\*.*" target="lib\netstandard1.0\en" /> | ||
<file src="Humanizer\bin\Release\netstandard2.0\en\*.*" target="lib\netstandard2.0\en" /> | ||
<file src="Humanizer\bin\Release\net6.0\en\*.*" target="lib\net6.0\en" /> | ||
<file src="..\logo.png" target="logo.png" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/Humanizer.Tests.Shared/Localisation/en/TimeSpanHyphenatedAgeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.en | ||
{ | ||
public class TimeSpanHyphenatedAgeTests | ||
{ | ||
[UseCulture("en-CA")] | ||
[Fact] | ||
public void HyphenatedAgeCa() | ||
{ | ||
Assert.Equal("5-day-old", TimeSpan.FromDays(5).ToHyphenatedAge()); | ||
} | ||
|
||
[UseCulture("en-GB")] | ||
[Fact] | ||
public void HyphenatedAgeGb() | ||
{ | ||
Assert.Equal("three-week-old", TimeSpan.FromDays(21).ToHyphenatedAge(toWords: true)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.