├── CNAME ├── logo.png ├── src ├── Humanizer │ ├── Humanizer.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Localisation │ │ ├── GrammaticalNumber │ │ │ ├── RussianGrammaticalNumber.cs │ │ │ └── RussianGrammaticalNumberDetector.cs │ │ ├── NumberToWords │ │ │ ├── FrenchSwissNumberToWordsConverter.cs │ │ │ ├── RomanianNumberToWordsConverter.cs │ │ │ ├── FrenchBelgianNumberToWordsConverter.cs │ │ │ ├── ItalianNumberToWordsConverter.cs │ │ │ ├── FrenchNumberToWordsConverter.cs │ │ │ ├── DefaultNumberToWordsConverter.cs │ │ │ ├── INumberToWordsConverter.cs │ │ │ └── GenderlessNumberToWordsConverter.cs │ │ ├── Ordinalizers │ │ │ ├── GermanOrdinalizer.cs │ │ │ ├── TurkishOrdinalizer.cs │ │ │ ├── DefaultOrdinalizer.cs │ │ │ ├── DutchOrdinalizer.cs │ │ │ ├── PortugueseOrdinalizer.cs │ │ │ ├── RussianOrdinalizer.cs │ │ │ ├── ItalianOrdinalizer.cs │ │ │ ├── SpanishOrdinalizer.cs │ │ │ ├── EnglishOrdinalizer.cs │ │ │ ├── IOrdinalizer.cs │ │ │ ├── UkrainianOrdinalizer.cs │ │ │ └── RomanianOrdinalizer.cs │ │ ├── TimeUnit.cs │ │ ├── DateToOrdinalWords │ │ │ ├── UsDateToOrdinalWordsConverter.cs │ │ │ ├── DefaultDateToOrdinalWordConverter.cs │ │ │ └── IDateToOrdinalWordConverter.cs │ │ ├── Tense.cs │ │ ├── ResourceKeys.Common.cs │ │ ├── CollectionFormatters │ │ │ ├── OxfordStyleCollectionFormatter.cs │ │ │ └── ICollectionFormatter.cs │ │ ├── Formatters │ │ │ ├── CzechSlovakPolishFormatter.cs │ │ │ ├── SerbianFormatter.cs │ │ │ ├── CroatianFormatter.cs │ │ │ ├── SlovenianFormatter.cs │ │ │ ├── ArabicFormatter.cs │ │ │ ├── RussianFormatter.cs │ │ │ ├── HebrewFormatter.cs │ │ │ ├── UkrainianFormatter.cs │ │ │ ├── RomanianFormatter.cs │ │ │ └── IFormatter.cs │ │ ├── Resources.cs │ │ └── ResourceKeys.TimeSpanHumanize.cs │ ├── Transformer │ │ ├── ToUpperCase.cs │ │ ├── ToLowerCase.cs │ │ ├── ToSentenceCase.cs │ │ ├── IStringTransformer.cs │ │ └── ToTitleCase.cs │ ├── RegexOptionsUtil.cs │ ├── FluentDate │ │ ├── In.cs │ │ ├── In.Months.tt │ │ └── On.Days.tt │ ├── OnNoMatch.cs │ ├── Plurality.cs │ ├── Configuration │ │ ├── DateToOrdinalWordsConverterRegistry.cs │ │ ├── OrdinalizerRegistry.cs │ │ └── CollectionFormatterRegistry.cs │ ├── GrammaticalGender.cs │ ├── DateTimeHumanizeStrategy │ │ ├── IDateTimeHumanizeStrategy.cs │ │ ├── IDateTimeOffsetHumanizeStrategy.cs │ │ ├── DefaultDateTimeHumanizeStrategy.cs │ │ ├── DefaultDateTimeOffsetHumanizeStrategy.cs │ │ ├── PrecisionDateTimeHumanizeStrategy.cs │ │ └── PrecisionDateTimeOffsetHumanizeStrategy.cs │ ├── LetterCasing.cs │ ├── NoMatchFoundException.cs │ ├── Truncation │ │ ├── ITruncator.cs │ │ ├── Truncator.cs │ │ └── FixedLengthTruncator.cs │ ├── StringDehumanizeExtensions.cs │ ├── Humanizer.csproj.DotSettings │ ├── GrammaticalCase.cs │ ├── CasingExtensions.cs │ ├── DateToOrdinalWordsExtensions.cs │ ├── StringExtensions.cs │ └── Humanizer.csproj ├── Humanizer.Tests.Uwp │ ├── Assets │ │ ├── StoreLogo.png │ │ ├── SplashScreen.scale-200.png │ │ ├── LockScreenLogo.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Wide310x150Logo.scale-200.png │ │ └── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── xunit.runner.json │ ├── Humanizer.Tests.Uwp_TemporaryKey.pfx │ ├── UnitTestApp.xaml │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── UnitTestApp.rd.xml │ └── Package.appxmanifest ├── Humanizer.Tests.Uwp.Runner │ ├── Assets │ │ ├── StoreLogo.png │ │ ├── SplashScreen.scale-200.png │ │ ├── LockScreenLogo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Wide310x150Logo.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ └── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── Humanizer.Tests.Uwp.Runner_TemporaryKey.pfx │ ├── App.xaml │ ├── App.xaml.cs │ └── Properties │ │ ├── AssemblyInfo.cs │ │ └── Default.rd.xml ├── Humanizer.Tests │ ├── xunit.runner.json │ ├── ApiApprover │ │ └── PublicApiApprovalTest.cs │ ├── Humanizer.Tests.csproj │ └── App_Packages │ │ └── ApiApprover.3.0.1 │ │ └── PublicApiApprover.cs ├── NuGet.config └── Humanizer.Tests.Shared │ ├── Localisation │ ├── de │ │ ├── DateToOrdinalWordsTests.cs │ │ ├── OrdinalizeTests.cs │ │ └── CollectionFormatterTests.cs │ ├── DefaultFormatterTests.cs │ ├── en │ │ └── DateToOrdinalWordsTests.cs │ ├── ResourcesTests.cs │ ├── nl │ │ └── OrdinalizeTests.cs │ ├── es │ │ └── NumberToWordsFeminineTest.cs │ ├── sv │ │ └── CollectionFormatterTests.cs │ ├── it │ │ └── CollectionFormatterTests.cs │ ├── ro-Ro │ │ └── CollectionFormatterTests.cs │ ├── invariant │ │ └── NumberToWordsTests.cs │ └── hr │ │ └── TimeSpanHumanizeTests.cs │ ├── FluentDate │ ├── OnTests.cs │ ├── PrepositionTests.cs │ └── InTests.cs │ ├── StringDehumanizeTests.cs │ ├── Humanizer.Tests.Shared.shproj │ ├── BitFieldEnumUnderTest.cs │ ├── StringExtensionsTests.cs │ ├── EnumHumanizeWithCustomDescriptionPropertyNamesTests.cs │ └── Bytes │ └── ComparingTests.cs ├── samples └── Humanizer.MvcSample │ ├── Views │ ├── _ViewStart.cshtml │ ├── Account │ │ ├── ChangePasswordSuccess.cshtml │ │ ├── Login.cshtml │ │ └── ChangePassword.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _LoginPartial.cshtml │ └── Home │ │ └── Contact.cshtml │ ├── favicon.ico │ ├── Images │ ├── accent.png │ ├── bullet.png │ ├── facebook.png │ ├── twitter.png │ ├── aspNetHome.png │ ├── heroAccent.png │ ├── NuGetGallery.png │ ├── findHosting.png │ ├── windowsLive.png │ ├── orderedListOne.png │ ├── orderedListTwo.png │ └── orderedListThree.png │ ├── Global.asax │ ├── Content │ └── themes │ │ └── base │ │ ├── images │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ ├── ui-icons_cd0a0a_256x240.png │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── jquery.ui.base.css │ │ ├── jquery.ui.all.css │ │ ├── jquery.ui.selectable.css │ │ ├── jquery.ui.progressbar.css │ │ ├── jquery.ui.accordion.css │ │ ├── jquery.ui.slider.css │ │ ├── jquery.ui.resizable.css │ │ └── jquery.ui.dialog.css │ ├── Scripts │ └── _references.js │ ├── Controllers │ └── HomeController.cs │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Properties │ └── AssemblyInfo.cs │ ├── HumanizerMetadataProvider.cs │ └── Global.asax.cs ├── scripts ├── SignClient.json └── Sign-Package.ps1 ├── version.json ├── .editorconfig ├── NuSpecs ├── Humanizer.Core.af.nuspec ├── Humanizer.Core.ar.nuspec ├── Humanizer.Core.bg.nuspec ├── Humanizer.Core.cs.nuspec ├── Humanizer.Core.da.nuspec ├── Humanizer.Core.de.nuspec ├── Humanizer.Core.el.nuspec ├── Humanizer.Core.es.nuspec ├── Humanizer.Core.fa.nuspec ├── Humanizer.Core.fr.nuspec ├── Humanizer.Core.he.nuspec ├── Humanizer.Core.hr.nuspec ├── Humanizer.Core.hu.nuspec ├── Humanizer.Core.id.nuspec ├── Humanizer.Core.it.nuspec ├── Humanizer.Core.ja.nuspec ├── Humanizer.Core.lv.nuspec ├── Humanizer.Core.nb.nuspec ├── Humanizer.Core.nl.nuspec ├── Humanizer.Core.pl.nuspec ├── Humanizer.Core.pt.nuspec ├── Humanizer.Core.ro.nuspec ├── Humanizer.Core.ru.nuspec ├── Humanizer.Core.sk.nuspec ├── Humanizer.Core.sl.nuspec ├── Humanizer.Core.sr.nuspec ├── Humanizer.Core.sv.nuspec ├── Humanizer.Core.tr.nuspec ├── Humanizer.Core.uk.nuspec ├── Humanizer.Core.vi.nuspec ├── Humanizer.Core.bn-BD.nuspec ├── Humanizer.Core.fi-FI.nuspec ├── Humanizer.Core.fr-BE.nuspec ├── Humanizer.Core.ko-KR.nuspec ├── Humanizer.Core.ms-MY.nuspec ├── Humanizer.Core.nb-NO.nuspec ├── Humanizer.Core.th-TH.nuspec ├── Humanizer.Core.zh-CN.nuspec ├── Humanizer.Core.fil-PH.nuspec ├── Humanizer.Core.sr-Latn.nuspec ├── Humanizer.Core.zh-Hans.nuspec ├── Humanizer.Core.zh-Hant.nuspec ├── Humanizer.Core.uz-Cyrl-UZ.nuspec ├── Humanizer.Core.uz-Latn-UZ.nuspec └── Humanizer.Core.nuspec ├── .github └── PULL_REQUEST_TEMPLATE.md ├── LICENSE ├── appveyor.yml └── .gitattributes /CNAME: -------------------------------------------------------------------------------- 1 | humanizr.net -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/logo.png -------------------------------------------------------------------------------- /src/Humanizer/Humanizer.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer/Humanizer.snk -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/favicon.ico -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp/Assets/StoreLogo.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/accent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/accent.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/bullet.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/facebook.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/twitter.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Humanizer.MvcSample.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/aspNetHome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/aspNetHome.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/heroAccent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/heroAccent.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/NuGetGallery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/NuGetGallery.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/findHosting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/findHosting.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/windowsLive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/windowsLive.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp.Runner/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/Humanizer.Tests/xunit.runner.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnosticMessages": true, 3 | "methodDisplay": "method", 4 | "parallelizeAssembly": true 5 | } 6 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/orderedListOne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/orderedListOne.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/orderedListTwo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/orderedListTwo.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Images/orderedListThree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Images/orderedListThree.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/xunit.runner.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnosticMessages": true, 3 | "methodDisplay": "method", 4 | "parallelizeAssembly": true 5 | } 6 | 7 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Humanizer.Tests.Uwp_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp/Humanizer.Tests.Uwp_TemporaryKey.pfx -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp.Runner/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp.Runner/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp.Runner/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp.Runner/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp.Runner/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Humanizer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: NeutralResourcesLanguage("en")] -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Humanizer.Tests.Uwp.Runner_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp.Runner/Humanizer.Tests.Uwp.Runner_TemporaryKey.pfx -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/src/Humanizer.Tests.Uwp.Runner/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadalli/Humanizer/dev/samples/Humanizer.MvcSample/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /src/Humanizer/Localisation/GrammaticalNumber/RussianGrammaticalNumber.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.GrammaticalNumber 2 | { 3 | internal enum RussianGrammaticalNumber 4 | { 5 | Singular, 6 | Paucal, 7 | Plural 8 | } 9 | } -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Views/Account/ChangePasswordSuccess.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Change Password"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |

Your password has been changed successfully.

8 |
9 | -------------------------------------------------------------------------------- /src/Humanizer/Transformer/ToUpperCase.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | class ToUpperCase : IStringTransformer 4 | { 5 | public string Transform(string input) 6 | { 7 | return input.ToUpper(); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Scripts/_references.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// -------------------------------------------------------------------------------- /src/Humanizer/Localisation/NumberToWords/FrenchSwissNumberToWordsConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Humanizer.Localisation.NumberToWords 5 | { 6 | internal class FrenchSwissNumberToWordsConverter : FrenchNumberToWordsConverterBase 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |
8 |

Error.

9 |

An error occurred while processing your request.

10 |
11 | -------------------------------------------------------------------------------- /src/NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/UnitTestApp.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Humanizer/Transformer/ToLowerCase.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace Humanizer 4 | { 5 | class ToLowerCase : IStringTransformer 6 | { 7 | public string Transform(string input) 8 | { 9 | return CultureInfo.CurrentCulture.TextInfo.ToLower(input); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/GermanOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class GermanOrdinalizer : DefaultOrdinalizer 4 | { 5 | public override string Convert(int number, string numberString) 6 | { 7 | return numberString + "."; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/App.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Humanizer/Transformer/ToSentenceCase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Humanizer 4 | { 5 | class ToSentenceCase : IStringTransformer 6 | { 7 | public string Transform(string input) 8 | { 9 | if (input.Length >= 1) 10 | return string.Concat(input.Substring(0, 1).ToUpper(), input.Substring(1)); 11 | 12 | return input.ToUpper(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /scripts/SignClient.json: -------------------------------------------------------------------------------- 1 | { 2 | "SignClient": { 3 | "AzureAd": { 4 | "AADInstance": "https://login.microsoftonline.com/", 5 | "ClientId": "6632f806-5a64-4bc6-87cf-b622b2ec62d3", 6 | "TenantId": "71048637-3782-41a3-b6b2-6f4ac8a25ae0" 7 | }, 8 | "Service": { 9 | "Url": "https://codesign.novotny.org/", 10 | "ResourceId": "https://SignService/0263d4ba-331b-46d1-85e1-bee9898a65a6" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/TimeUnit.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation 2 | { 3 | /// 4 | /// Units of time. 5 | /// 6 | #pragma warning disable 1591 7 | public enum TimeUnit 8 | { 9 | Millisecond, 10 | Second, 11 | Minute, 12 | Hour, 13 | Day, 14 | Week, 15 | Month, 16 | Year 17 | } 18 | #pragma warning restore 1591 19 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/de/DateToOrdinalWordsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.Localisation.de 5 | { 6 | [UseCulture("de")] 7 | public class DateToOrdinalWordsTests 8 | { 9 | [Fact] 10 | public void OrdinalizeString() 11 | { 12 | Assert.Equal("1. Januar 2015", new DateTime(2015, 1, 1).ToOrdinalWords()); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Humanizer/RegexOptionsUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace Humanizer 5 | { 6 | internal static class RegexOptionsUtil 7 | { 8 | static RegexOptionsUtil() 9 | { 10 | Compiled = Enum.TryParse("Compiled", out RegexOptions compiled) ? compiled : RegexOptions.None; 11 | } 12 | 13 | public static RegexOptions Compiled { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/DateToOrdinalWords/UsDateToOrdinalWordsConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Humanizer.Localisation.DateToOrdinalWords 4 | { 5 | internal class UsDateToOrdinalWordsConverter : DefaultDateToOrdinalWordConverter 6 | { 7 | public override string Convert(DateTime date) 8 | { 9 | return date.ToString("MMMM ") + date.Day.Ordinalize() + date.ToString(", yyyy"); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Humanizer/Transformer/IStringTransformer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Can tranform a string 5 | /// 6 | public interface IStringTransformer 7 | { 8 | /// 9 | /// Transform the input 10 | /// 11 | /// String to be transformed 12 | /// 13 | string Transform(string input); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/TurkishOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Humanizer.Localisation.Ordinalizers 7 | { 8 | internal class TurkishOrdinalizer : DefaultOrdinalizer 9 | { 10 | public override string Convert(int number, string numberString) 11 | { 12 | return numberString + "."; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Humanizer/FluentDate/In.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Humanizer 3 | { 4 | public partial class In 5 | { 6 | /// 7 | /// Returns the first of January of the provided year 8 | /// 9 | /// 10 | /// 11 | public static DateTime TheYear(int year) 12 | { 13 | return new DateTime(year, 1, 1); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Tense.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation 2 | { 3 | /// 4 | /// Enumerates the possible time references; past or future. 5 | /// 6 | public enum Tense 7 | { 8 | /// 9 | /// Indicates the future. 10 | /// 11 | Future, 12 | 13 | /// 14 | /// Indicates the past. 15 | /// 16 | Past 17 | } 18 | } -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.2.1-preview.{height}", 3 | "publicReleaseRefSpec": [ 4 | "^refs/heads/master$", // we release out of master 5 | "^refs/heads/dev$", // we release out of develop 6 | "^refs/tags/v\\d+\\.\\d+" // we also release tags starting with vN.N 7 | ], 8 | "nugetPackageVersion":{ 9 | "semVer": 2 10 | }, 11 | "cloudBuild": { 12 | "buildNumber": { 13 | "enabled": true, 14 | "setVersionVariables": true 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/DefaultOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class DefaultOrdinalizer : IOrdinalizer 4 | { 5 | public virtual string Convert(int number, string numberString, GrammaticalGender gender) 6 | { 7 | return Convert(number, numberString); 8 | } 9 | 10 | public virtual string Convert(int number, string numberString) 11 | { 12 | return numberString; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/jquery.ui.base.css: -------------------------------------------------------------------------------- 1 | @import url("jquery.ui.core.css"); 2 | @import url("jquery.ui.resizable.css"); 3 | @import url("jquery.ui.selectable.css"); 4 | @import url("jquery.ui.accordion.css"); 5 | @import url("jquery.ui.autocomplete.css"); 6 | @import url("jquery.ui.button.css"); 7 | @import url("jquery.ui.dialog.css"); 8 | @import url("jquery.ui.slider.css"); 9 | @import url("jquery.ui.tabs.css"); 10 | @import url("jquery.ui.datepicker.css"); 11 | @import url("jquery.ui.progressbar.css"); -------------------------------------------------------------------------------- /src/Humanizer/Localisation/ResourceKeys.Common.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Humanizer.Localisation 4 | { 5 | /// 6 | /// 7 | /// 8 | public partial class ResourceKeys 9 | { 10 | private const string Single = "Single"; 11 | private const string Multiple = "Multiple"; 12 | 13 | private static void ValidateRange(int count) 14 | { 15 | if (count < 0) 16 | throw new ArgumentOutOfRangeException(nameof(count)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Humanizer/OnNoMatch.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Dictating what should be done when a match is not found - currently used only for DehumanizeTo 5 | /// 6 | public enum OnNoMatch 7 | { 8 | /// 9 | /// This is the default behavior which throws a NoMatchFoundException 10 | /// 11 | ThrowsException, 12 | 13 | /// 14 | /// If set to ReturnsNull the method returns null instead of throwing an exception 15 | /// 16 | ReturnsNull 17 | } 18 | } -------------------------------------------------------------------------------- /src/Humanizer/Plurality.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Provides hint for Humanizer as to whether a word is singular, plural or with unknown plurality 5 | /// 6 | public enum Plurality 7 | { 8 | /// 9 | /// The word is singular 10 | /// 11 | Singular, 12 | /// 13 | /// The word is plural 14 | /// 15 | Plural, 16 | /// 17 | /// I am unsure of the plurality 18 | /// 19 | CouldBeEither 20 | } 21 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/CollectionFormatters/OxfordStyleCollectionFormatter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Humanizer.Localisation.CollectionFormatters 6 | { 7 | internal class OxfordStyleCollectionFormatter : DefaultCollectionFormatter 8 | { 9 | public OxfordStyleCollectionFormatter(string defaultSeparator) 10 | : base(defaultSeparator ?? "and") 11 | { 12 | } 13 | 14 | protected override string GetConjunctionFormatString(int itemCount) => itemCount > 2 ? "{0}, {1} {2}" : "{0} {1} {2}"; 15 | } 16 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/DateToOrdinalWords/DefaultDateToOrdinalWordConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Humanizer.Localisation.DateToOrdinalWords 4 | { 5 | internal class DefaultDateToOrdinalWordConverter : IDateToOrdinalWordConverter 6 | { 7 | 8 | public virtual string Convert(DateTime date) 9 | { 10 | return date.Day.Ordinalize() + date.ToString(" MMMM yyyy"); 11 | } 12 | 13 | public virtual string Convert(DateTime date, GrammaticalCase grammaticalCase) 14 | { 15 | return Convert(date); 16 | } 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /src/Humanizer/Configuration/DateToOrdinalWordsConverterRegistry.cs: -------------------------------------------------------------------------------- 1 | using Humanizer.Localisation.DateToOrdinalWords; 2 | namespace Humanizer.Configuration 3 | { 4 | internal class DateToOrdinalWordsConverterRegistry : LocaliserRegistry 5 | { 6 | public DateToOrdinalWordsConverterRegistry() : base(new DefaultDateToOrdinalWordConverter()) 7 | { 8 | Register("en-UK", new DefaultDateToOrdinalWordConverter()); 9 | Register("de", new DefaultDateToOrdinalWordConverter()); 10 | Register("en-US", new UsDateToOrdinalWordsConverter()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Humanizer/GrammaticalGender.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Options for specifying the desired grammatical gender for the output words 5 | /// 6 | public enum GrammaticalGender 7 | { 8 | /// 9 | /// Indicates masculine grammatical gender 10 | /// 11 | Masculine, 12 | /// 13 | /// Indicates feminine grammatical gender 14 | /// 15 | Feminine, 16 | /// 17 | /// Indicates neuter grammatical gender 18 | /// 19 | Neuter 20 | } 21 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/DutchOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class DutchOrdinalizer : DefaultOrdinalizer 4 | { 5 | public override string Convert(int number, string numberString) 6 | { 7 | return Convert(number, numberString, GrammaticalGender.Masculine); 8 | } 9 | 10 | public override string Convert(int number, string numberString, GrammaticalGender gender) 11 | { 12 | // N/A in Dutch 13 | if (number == 0) 14 | return "0"; 15 | 16 | return numberString + "e"; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/DefaultFormatterTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Humanizer.Localisation; 4 | using Humanizer.Localisation.Formatters; 5 | using Xunit; 6 | 7 | namespace Humanizer.Tests.Localisation 8 | { 9 | public class DefaultFormatterTests 10 | { 11 | 12 | [Fact] 13 | [UseCulture("es")] 14 | public void HandlesNotImplementedCollectionFormattersGracefully() 15 | { 16 | var a = new[] {DateTime.UtcNow, DateTime.UtcNow.AddDays(10)}; 17 | var b = a.Humanize(); 18 | 19 | Assert.Equal(a[0] + " & " + a[1], b); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/en/DateToOrdinalWordsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.Localisation.en 5 | { 6 | public class DateToOrdinalWordsTests 7 | { 8 | [UseCulture("en-GB")] 9 | [Fact] 10 | public void OrdinalizeStringGb() 11 | { 12 | Assert.Equal("1st January 2015", new DateTime(2015, 1, 1).ToOrdinalWords()); 13 | } 14 | 15 | [UseCulture("en-US")] 16 | [Fact] 17 | public void OrdinalizeStringUs() 18 | { 19 | Assert.Equal("January 1st, 2015", new DateTime(2015, 1, 1).ToOrdinalWords()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Humanizer/DateTimeHumanizeStrategy/IDateTimeHumanizeStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Humanizer.DateTimeHumanizeStrategy 5 | { 6 | /// 7 | /// Implement this interface to create a new strategy for DateTime.Humanize and hook it in the Configurator.DateTimeHumanizeStrategy 8 | /// 9 | public interface IDateTimeHumanizeStrategy 10 | { 11 | /// 12 | /// Calculates the distance of time in words between two provided dates used for DateTime.Humanize 13 | /// 14 | string Humanize(DateTime input, DateTime comparisonBase, CultureInfo culture); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/CzechSlovakPolishFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Formatters 2 | { 3 | internal class CzechSlovakPolishFormatter : DefaultFormatter 4 | { 5 | private const string PaucalPostfix = "_Paucal"; 6 | 7 | public CzechSlovakPolishFormatter(string localeCode) 8 | : base(localeCode) 9 | { 10 | } 11 | 12 | protected override string GetResourceKey(string resourceKey, int number) 13 | { 14 | if (number > 1 && number < 5) 15 | return resourceKey + PaucalPostfix; 16 | 17 | return resourceKey; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/SerbianFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Formatters 2 | { 3 | internal class SerbianFormatter : DefaultFormatter 4 | { 5 | private const string PaucalPostfix = "_Paucal"; 6 | 7 | public SerbianFormatter(string localeCode) 8 | : base(localeCode) 9 | { 10 | } 11 | 12 | protected override string GetResourceKey(string resourceKey, int number) 13 | { 14 | var mod10 = number % 10; 15 | 16 | if (mod10 > 1 && mod10 < 5) 17 | return resourceKey + PaucalPostfix; 18 | 19 | return resourceKey; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Humanizer/DateTimeHumanizeStrategy/IDateTimeOffsetHumanizeStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Humanizer.DateTimeHumanizeStrategy 5 | { 6 | /// 7 | /// Implement this interface to create a new strategy for DateTime.Humanize and hook it in the Configurator.DateTimeOffsetHumanizeStrategy 8 | /// 9 | public interface IDateTimeOffsetHumanizeStrategy 10 | { 11 | /// 12 | /// Calculates the distance of time in words between two provided dates used for DateTimeOffset.Humanize 13 | /// 14 | string Humanize(DateTimeOffset input, DateTimeOffset comparisonBase, CultureInfo culture); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Humanizer/LetterCasing.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Options for specifying the desired letter casing for the output string 5 | /// 6 | public enum LetterCasing 7 | { 8 | /// 9 | /// SomeString -> Some String 10 | /// 11 | Title, 12 | /// 13 | /// SomeString -> SOME STRING 14 | /// 15 | AllCaps, 16 | /// 17 | /// SomeString -> some string 18 | /// 19 | LowerCase, 20 | /// 21 | /// SomeString -> Some string 22 | /// 23 | Sentence, 24 | } 25 | } -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @if (Request.IsAuthenticated) { 2 |

3 | Hello, @Html.ActionLink(User.Identity.Name, "ChangePassword", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Change password" })! 4 | @Html.ActionLink("Log off", "LogOff", "Account") 5 |

6 | } else { 7 |
    8 |
  • @Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink", data_dialog_title = "Registration" })
  • 9 |
  • @Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink", data_dialog_title = "Identification" })
  • 10 |
11 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/CroatianFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Formatters 2 | { 3 | internal class CroatianFormatter : DefaultFormatter 4 | { 5 | private const string DualTrialQuadralPostfix = "_DualTrialQuadral"; 6 | 7 | public CroatianFormatter() 8 | : base("hr") 9 | { 10 | } 11 | 12 | protected override string GetResourceKey(string resourceKey, int number) 13 | { 14 | if ((number % 10 == 2 || number % 10 == 3 || number % 10 == 4) && number != 12 && number != 13 && number != 14) 15 | return resourceKey + DualTrialQuadralPostfix; 16 | 17 | return resourceKey; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/jquery.ui.all.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI CSS Framework 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Theming 14 | */ 15 | @import "jquery.ui.base.css"; 16 | @import "jquery.ui.theme.css"; 17 | -------------------------------------------------------------------------------- /src/Humanizer/NoMatchFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Humanizer 4 | { 5 | /// 6 | /// This is thrown on String.DehumanizeTo enum when the provided string cannot be mapped to the target enum 7 | /// 8 | #pragma warning disable 1591 9 | public class NoMatchFoundException : Exception 10 | { 11 | public NoMatchFoundException() 12 | { 13 | } 14 | 15 | public NoMatchFoundException(string message) 16 | : base(message) 17 | { 18 | } 19 | 20 | public NoMatchFoundException(string message, Exception inner) 21 | : base(message, inner) 22 | { 23 | } 24 | } 25 | #pragma warning restore 1591 26 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/FluentDate/OnTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.FluentDate 5 | { 6 | public class OnTests 7 | { 8 | [Fact] 9 | public void OnJanuaryThe23rd() 10 | { 11 | Assert.Equal(new DateTime(DateTime.Now.Year, 1, 23), On.January.The23rd); 12 | } 13 | 14 | [Fact] 15 | public void OnDecemberThe4th() 16 | { 17 | Assert.Equal(new DateTime(DateTime.Now.Year, 12, 4), On.December.The4th); 18 | } 19 | 20 | [Fact] 21 | public void OnFebruaryThe() 22 | { 23 | Assert.Equal(new DateTime(DateTime.Now.Year, 2, 11), On.February.The(11)); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Humanizer/DateTimeHumanizeStrategy/DefaultDateTimeHumanizeStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Humanizer.DateTimeHumanizeStrategy 5 | { 6 | /// 7 | /// The default 'distance of time' -> words calculator. 8 | /// 9 | public class DefaultDateTimeHumanizeStrategy : IDateTimeHumanizeStrategy 10 | { 11 | /// 12 | /// Calculates the distance of time in words between two provided dates 13 | /// 14 | public string Humanize(DateTime input, DateTime comparisonBase, CultureInfo culture) 15 | { 16 | return DateTimeHumanizeAlgorithms.DefaultHumanize(input, comparisonBase, culture); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Default settings: 7 | # A newline ending every file 8 | # Use 4 spaces as indentation 9 | [*] 10 | insert_final_newline = true 11 | indent_style = space 12 | indent_size = 4 13 | 14 | # C++ Files 15 | [*.{cpp,h,in}] 16 | curly_bracket_next_line = true 17 | indent_brace_style = Allman 18 | 19 | # Xml project files 20 | [*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] 21 | indent_size = 2 22 | 23 | # Xml files 24 | [*.{xml,stylecop,resx,ruleset}] 25 | indent_size = 2 26 | 27 | # Xml config files 28 | [*.{props,targets,config,nuspec}] 29 | indent_size = 2 30 | 31 | # Shell scripts 32 | [*.sh] 33 | end_of_line = lf 34 | [*.{cmd, bat}] 35 | end_of_line = crlf 36 | 37 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/jquery.ui.selectable.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Selectable 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Selectable#theming 14 | */ 15 | .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } 16 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/PortugueseOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class PortugueseOrdinalizer : DefaultOrdinalizer 4 | { 5 | public override string Convert(int number, string numberString) 6 | { 7 | return Convert(number, numberString, GrammaticalGender.Masculine); 8 | } 9 | 10 | public override string Convert(int number, string numberString, GrammaticalGender gender) 11 | { 12 | // N/A in Portuguese 13 | if (number == 0) 14 | return "0"; 15 | 16 | if (gender == GrammaticalGender.Feminine) 17 | return numberString + "ª"; 18 | 19 | return numberString + "º"; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/jquery.ui.progressbar.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Progressbar 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Progressbar#theming 14 | */ 15 | .ui-progressbar { height:2em; text-align: left; } 16 | .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } -------------------------------------------------------------------------------- /src/Humanizer/DateTimeHumanizeStrategy/DefaultDateTimeOffsetHumanizeStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Humanizer.DateTimeHumanizeStrategy 5 | { 6 | /// 7 | /// The default 'distance of time' -> words calculator. 8 | /// 9 | public class DefaultDateTimeOffsetHumanizeStrategy : IDateTimeOffsetHumanizeStrategy 10 | { 11 | /// 12 | /// Calculates the distance of time in words between two provided dates 13 | /// 14 | public string Humanize(DateTimeOffset input, DateTimeOffset comparisonBase, CultureInfo culture) 15 | { 16 | return DateTimeHumanizeAlgorithms.DefaultHumanize(input.UtcDateTime, comparisonBase.UtcDateTime, culture); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/RussianOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class RussianOrdinalizer : DefaultOrdinalizer 4 | { 5 | public override string Convert(int number, string numberString) 6 | { 7 | return Convert(number, numberString, GrammaticalGender.Masculine); 8 | } 9 | 10 | public override string Convert(int number, string numberString, GrammaticalGender gender) 11 | { 12 | if (gender == GrammaticalGender.Masculine) 13 | return numberString + "-й"; 14 | 15 | if (gender == GrammaticalGender.Feminine) 16 | return numberString + "-я"; 17 | 18 | return numberString + "-е"; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/ItalianOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class ItalianOrdinalizer : DefaultOrdinalizer 4 | { 5 | public override string Convert(int number, string numberString) 6 | { 7 | return Convert(number, numberString, GrammaticalGender.Masculine); 8 | } 9 | 10 | public override string Convert(int number, string numberString, GrammaticalGender gender) 11 | { 12 | // No ordinal for 0 in italian (neologism apart) 13 | if (number == 0) 14 | return "0"; 15 | 16 | if (gender == GrammaticalGender.Feminine) 17 | return numberString + "ª"; 18 | 19 | return numberString + "°"; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/SpanishOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class SpanishOrdinalizer : DefaultOrdinalizer 4 | { 5 | public override string Convert(int number, string numberString) 6 | { 7 | return Convert(number, numberString, GrammaticalGender.Masculine); 8 | } 9 | 10 | public override string Convert(int number, string numberString, GrammaticalGender gender) 11 | { 12 | // N/A in Spanish 13 | if (number == 0) 14 | return "0"; 15 | 16 | if (gender == GrammaticalGender.Feminine) 17 | return numberString + ".ª"; 18 | else 19 | return numberString + ".º"; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Humanizer/Truncation/ITruncator.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Can truncate a string. 5 | /// 6 | public interface ITruncator 7 | { 8 | /// 9 | /// Truncate a string 10 | /// 11 | /// The string to truncate 12 | /// The length to truncate to 13 | /// The string used to truncate with 14 | /// The enum value used to determine from where to truncate the string 15 | /// The truncated string 16 | string Truncate(string value, int length, string truncationString, TruncateFrom truncateFrom = TruncateFrom.Right); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Humanizer/StringDehumanizeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Humanizer 4 | { 5 | /// 6 | /// Contains extension methods for dehumanizing strings. 7 | /// 8 | public static class StringDehumanizeExtensions 9 | { 10 | /// 11 | /// Dehumanizes a string; e.g. 'some string', 'Some String', 'Some string' -> 'SomeString' 12 | /// 13 | /// The string to be dehumanized 14 | /// 15 | public static string Dehumanize(this string input) 16 | { 17 | var titlizedWords = input.Split(' ').Select(word => word.Humanize(LetterCasing.Title)); 18 | return string.Join("", titlizedWords).Replace(" ", ""); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/GrammaticalNumber/RussianGrammaticalNumberDetector.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.GrammaticalNumber 2 | { 3 | internal static class RussianGrammaticalNumberDetector 4 | { 5 | public static RussianGrammaticalNumber Detect(int number) 6 | { 7 | var tens = number % 100 / 10; 8 | if (tens != 1) 9 | { 10 | var unity = number % 10; 11 | 12 | if (unity == 1) // 1, 21, 31, 41 ... 91, 101, 121 ... 13 | return RussianGrammaticalNumber.Singular; 14 | 15 | if (unity > 1 && unity < 5) // 2, 3, 4, 22, 23, 24 ... 16 | return RussianGrammaticalNumber.Paucal; 17 | } 18 | 19 | return RussianGrammaticalNumber.Plural; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Humanizer/Humanizer.csproj.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True 3 | True 4 | False 5 | True -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/ResourcesTests.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Humanizer.Localisation; 3 | using Xunit; 4 | 5 | namespace Humanizer.Tests.Localisation 6 | { 7 | public class ResourcesTests 8 | { 9 | [Fact] 10 | [UseCulture("ro")] 11 | public void CanGetCultureSpecificTranslationsWithImplicitCulture() 12 | { 13 | var format = Resources.GetResource("DateHumanize_MultipleYearsAgo"); 14 | Assert.Equal("acum {0}{1} ani", format); 15 | } 16 | 17 | [Fact] 18 | public void CanGetCultureSpecificTranslationsWithExplicitCulture() 19 | { 20 | var format = Resources.GetResource("DateHumanize_MultipleYearsAgo", new CultureInfo("ro")); 21 | Assert.Equal("acum {0}{1} ani", format); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/EnglishOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class EnglishOrdinalizer : DefaultOrdinalizer 4 | { 5 | public override string Convert(int number, string numberString) 6 | { 7 | var nMod100 = number % 100; 8 | 9 | if (nMod100 >= 11 && nMod100 <= 13) 10 | return numberString + "th"; 11 | 12 | switch (number % 10) 13 | { 14 | case 1: 15 | return numberString + "st"; 16 | 17 | case 2: 18 | return numberString + "nd"; 19 | 20 | case 3: 21 | return numberString + "rd"; 22 | 23 | default: 24 | return numberString + "th"; 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace Humanizer.MvcSample.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; 14 | 15 | return View(); 16 | } 17 | 18 | public ActionResult About() 19 | { 20 | ViewBag.Message = "Your quintessential app description page."; 21 | 22 | return View(); 23 | } 24 | 25 | public ActionResult Contact() 26 | { 27 | ViewBag.Message = "Your quintessential contact page."; 28 | 29 | return View(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/de/OrdinalizeTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Humanizer.Tests.Localisation.de 4 | { 5 | [UseCulture("de-DE")] 6 | public class OrdinalizeTests 7 | { 8 | [Theory] 9 | [InlineData("0", "0.")] 10 | [InlineData("1", "1.")] 11 | [InlineData("2", "2.")] 12 | [InlineData("3", "3.")] 13 | [InlineData("4", "4.")] 14 | [InlineData("5", "5.")] 15 | [InlineData("6", "6.")] 16 | [InlineData("23", "23.")] 17 | [InlineData("100", "100.")] 18 | [InlineData("101", "101.")] 19 | [InlineData("102", "102.")] 20 | [InlineData("103", "103.")] 21 | [InlineData("1001", "1001.")] 22 | public void OrdinalizeString(string number, string ordinalized) 23 | { 24 | Assert.Equal(ordinalized, number.Ordinalize()); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/nl/OrdinalizeTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Humanizer.Tests.Localisation.nl 4 | { 5 | [UseCulture("nl")] 6 | public class OrdinalizeTests 7 | { 8 | 9 | [Theory] 10 | [InlineData("0", "0")] 11 | [InlineData("1", "1e")] 12 | [InlineData("2", "2e")] 13 | [InlineData("3", "3e")] 14 | [InlineData("4", "4e")] 15 | [InlineData("5", "5e")] 16 | [InlineData("6", "6e")] 17 | [InlineData("23", "23e")] 18 | [InlineData("100", "100e")] 19 | [InlineData("101", "101e")] 20 | [InlineData("102", "102e")] 21 | [InlineData("103", "103e")] 22 | [InlineData("1001", "1001e")] 23 | public void OrdinalizeString(string number, string ordinalized) 24 | { 25 | Assert.Equal(number.Ordinalize(), ordinalized); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Humanizer/Configuration/OrdinalizerRegistry.cs: -------------------------------------------------------------------------------- 1 | using Humanizer.Localisation.Ordinalizers; 2 | 3 | namespace Humanizer.Configuration 4 | { 5 | internal class OrdinalizerRegistry : LocaliserRegistry 6 | { 7 | public OrdinalizerRegistry() : base(new DefaultOrdinalizer()) 8 | { 9 | Register("de", new GermanOrdinalizer()); 10 | Register("en", new EnglishOrdinalizer()); 11 | Register("es", new SpanishOrdinalizer()); 12 | Register("it", new ItalianOrdinalizer()); 13 | Register("nl", new DutchOrdinalizer()); 14 | Register("pt", new PortugueseOrdinalizer()); 15 | Register("ro", new RomanianOrdinalizer()); 16 | Register("ru", new RussianOrdinalizer()); 17 | Register("tr", new TurkishOrdinalizer()); 18 | Register("uk", new UkrainianOrdinalizer()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/SlovenianFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Formatters 2 | { 3 | internal class SlovenianFormatter : DefaultFormatter 4 | { 5 | private const string DualPostfix = "_Dual"; 6 | private const string TrialQuadralPostfix = "_TrialQuadral"; 7 | 8 | public SlovenianFormatter() 9 | : base("sl") 10 | { 11 | } 12 | 13 | protected override string GetResourceKey(string resourceKey, int number) 14 | { 15 | if (number == 2) 16 | return resourceKey + DualPostfix; 17 | 18 | // When the count is three or four some some words have a different form when counting in Slovenian language 19 | if (number == 3 || number == 4) 20 | return resourceKey + TrialQuadralPostfix; 21 | 22 | return resourceKey; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/DateToOrdinalWords/IDateToOrdinalWordConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Humanizer.Localisation.DateToOrdinalWords 4 | { 5 | /// 6 | /// The interface used to localise the ToOrdinalWords method. 7 | /// 8 | public interface IDateToOrdinalWordConverter 9 | { 10 | /// 11 | /// Converts the date to Ordinal Words 12 | /// 13 | /// 14 | /// 15 | string Convert(DateTime date); 16 | 17 | /// 18 | /// Converts the date to Ordinal Words using the provided grammatical case 19 | /// 20 | /// 21 | /// 22 | /// 23 | string Convert(DateTime date, GrammaticalCase grammaticalCase); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /scripts/Sign-Package.ps1: -------------------------------------------------------------------------------- 1 | $currentDirectory = split-path $MyInvocation.MyCommand.Definition 2 | 3 | # See if we have the ClientSecret available 4 | if([string]::IsNullOrEmpty($env:SignClientSecret)){ 5 | Write-Host "Client Secret not found, not signing packages" 6 | return; 7 | } 8 | 9 | # Setup Variables we need to pass into the sign client tool 10 | 11 | $appSettings = "$currentDirectory\SignClient.json" 12 | 13 | $appPath = "$currentDirectory\..\packages\SignClient\tools\netcoreapp2.0\SignClient.dll" 14 | 15 | $nupgks = ls $currentDirectory\..\*.nupkg | Select -ExpandProperty FullName 16 | 17 | foreach ($nupkg in $nupgks){ 18 | Write-Host "Submitting $nupkg for signing" 19 | 20 | dotnet $appPath 'sign' -c $appSettings -i $nupkg -r $env:SignClientUser -s $env:SignClientSecret -n 'Humanizer' -d 'Humanizer' -u 'https://github.com/Humanizr/Humanizer' 21 | 22 | Write-Host "Finished signing $nupkg" 23 | } 24 | 25 | Write-Host "Sign-package complete" -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/ArabicFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Formatters 2 | { 3 | internal class ArabicFormatter : DefaultFormatter 4 | { 5 | private const string DualPostfix = "_Dual"; 6 | private const string PluralPostfix = "_Plural"; 7 | 8 | public ArabicFormatter() 9 | : base("ar") 10 | { 11 | } 12 | 13 | protected override string GetResourceKey(string resourceKey, int number) 14 | { 15 | //In Arabic pluralization 2 entities gets a different word. 16 | if (number == 2) 17 | return resourceKey + DualPostfix; 18 | 19 | //In Arabic pluralization entities where the count is between 3 and 10 gets a different word. 20 | if (number >= 3 && number <= 10 ) 21 | return resourceKey + PluralPostfix; 22 | 23 | return resourceKey; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/es/NumberToWordsFeminineTest.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Humanizer.Tests.Localisation.es 4 | { 5 | [UseCulture("es-ES")] 6 | public class NumberToWordsFeminineTests 7 | { 8 | 9 | [Theory] 10 | [InlineData(1, "una")] 11 | [InlineData(21, "veintiuna")] 12 | [InlineData(31, "treinta y una")] 13 | [InlineData(81, "ochenta y una")] 14 | [InlineData(500, "quinientas")] 15 | [InlineData(701, "setecientas una")] 16 | [InlineData(3500, "tres mil quinientas")] 17 | [InlineData(200121, "doscientas mil ciento veintiuna")] 18 | [InlineData(200000121, "doscientos millones ciento veintiuna")] 19 | [InlineData(1000001, "un millón una")] 20 | public void ToWords(int number, string expected) 21 | { 22 | Assert.Equal(expected, number.ToWords(GrammaticalGender.Feminine)); 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/IOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | /// 4 | /// The interface used to localise the Ordinalize method 5 | /// 6 | public interface IOrdinalizer 7 | { 8 | /// 9 | /// Ordinalizes the number 10 | /// 11 | /// 12 | /// 13 | /// 14 | string Convert(int number, string numberString); 15 | 16 | /// 17 | /// Ordinalizes the number using the provided grammatical gender 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | string Convert(int number, string numberString, GrammaticalGender gender); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/NumberToWords/RomanianNumberToWordsConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Humanizer.Localisation.NumberToWords.Romanian; 3 | 4 | namespace Humanizer.Localisation.NumberToWords 5 | { 6 | internal class RomanianNumberToWordsConverter : GenderedNumberToWordsConverter 7 | { 8 | public override string Convert(long number, GrammaticalGender gender) 9 | { 10 | if (number > Int32.MaxValue || number < Int32.MinValue) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | var converter = new RomanianCardinalNumberConverter(); 15 | return converter.Convert((int)number, gender); 16 | } 17 | 18 | public override string ConvertToOrdinal(int number, GrammaticalGender gender) 19 | { 20 | var converter = new RomanianOrdinalNumberConverter(); 21 | return converter.Convert(number, gender); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Humanizer/Transformer/ToTitleCase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Humanizer 6 | { 7 | class ToTitleCase : IStringTransformer 8 | { 9 | public string Transform(string input) 10 | { 11 | var words = input.Split(' '); 12 | var result = new List(); 13 | foreach (var word in words) 14 | { 15 | if (word.Length == 0 || AllCapitals(word)) 16 | result.Add(word); 17 | else if(word.Length == 1) 18 | result.Add(word.ToUpper()); 19 | else 20 | result.Add(char.ToUpper(word[0]) + word.Remove(0, 1).ToLower()); 21 | } 22 | 23 | return string.Join(" ", result); 24 | } 25 | 26 | static bool AllCapitals(string input) 27 | { 28 | return input.ToCharArray().All(char.IsUpper); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/RussianFormatter.cs: -------------------------------------------------------------------------------- 1 | using Humanizer.Localisation.GrammaticalNumber; 2 | 3 | namespace Humanizer.Localisation.Formatters 4 | { 5 | internal class RussianFormatter : DefaultFormatter 6 | { 7 | public RussianFormatter() 8 | : base("ru") 9 | { 10 | } 11 | 12 | protected override string GetResourceKey(string resourceKey, int number) 13 | { 14 | var grammaticalNumber = RussianGrammaticalNumberDetector.Detect(number); 15 | var suffix = GetSuffix(grammaticalNumber); 16 | return resourceKey + suffix; 17 | } 18 | 19 | private string GetSuffix(RussianGrammaticalNumber grammaticalNumber) 20 | { 21 | if (grammaticalNumber == RussianGrammaticalNumber.Singular) 22 | return "_Singular"; 23 | if (grammaticalNumber == RussianGrammaticalNumber.Paucal) 24 | return "_Paucal"; 25 | return ""; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/FluentDate/PrepositionTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.FluentDate 5 | { 6 | public class PrepositionTests 7 | { 8 | [Fact] 9 | public void AtMidnight() 10 | { 11 | var now = DateTime.Now; 12 | var midnight = now.AtMidnight(); 13 | Assert.Equal(new DateTime(now.Year, now.Month, now.Day), midnight); 14 | } 15 | 16 | [Fact] 17 | public void AtNoon() 18 | { 19 | var now = DateTime.Now; 20 | var noon = now.AtNoon(); 21 | Assert.Equal(new DateTime(now.Year, now.Month, now.Day, 12, 0, 0), noon); 22 | } 23 | 24 | [Fact] 25 | public void InYear() 26 | { 27 | var now = DateTime.Now; 28 | var in2011 = now.In(2011); 29 | Assert.Equal(new DateTime(2011, now.Month, now.Day, now.Hour, now.Minute, now.Second, now.Millisecond), in2011); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/HebrewFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Formatters 2 | { 3 | internal class HebrewFormatter : DefaultFormatter 4 | { 5 | private const string DualPostfix = "_Dual"; 6 | private const string PluralPostfix = "_Plural"; 7 | 8 | public HebrewFormatter() 9 | : base("he") 10 | { 11 | } 12 | 13 | protected override string GetResourceKey(string resourceKey, int number) 14 | { 15 | //In Hebrew pluralization 2 entities gets a different word. 16 | if (number == 2) 17 | return resourceKey + DualPostfix; 18 | 19 | //In Hebrew pluralization entities where the count is between 3 and 10 gets a different word. 20 | //See http://lib.cet.ac.il/pages/item.asp?item=21585 for explanation 21 | if (number >= 3 && number <= 10) 22 | return resourceKey + PluralPostfix; 23 | 24 | return resourceKey; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs: -------------------------------------------------------------------------------- 1 | using Humanizer.Localisation.GrammaticalNumber; 2 | 3 | namespace Humanizer.Localisation.Formatters 4 | { 5 | internal class UkrainianFormatter : DefaultFormatter 6 | { 7 | public UkrainianFormatter() 8 | : base("uk") 9 | { 10 | } 11 | 12 | protected override string GetResourceKey(string resourceKey, int number) 13 | { 14 | var grammaticalNumber = RussianGrammaticalNumberDetector.Detect(number); 15 | var suffix = GetSuffix(grammaticalNumber); 16 | return resourceKey + suffix; 17 | } 18 | 19 | private string GetSuffix(RussianGrammaticalNumber grammaticalNumber) 20 | { 21 | if (grammaticalNumber == RussianGrammaticalNumber.Singular) 22 | return "_Singular"; 23 | if (grammaticalNumber == RussianGrammaticalNumber.Paucal) 24 | return "_Paucal"; 25 | return ""; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/sv/CollectionFormatterTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.Localisation.sv 5 | { 6 | [UseCulture("sv-SE")] 7 | public class CollectionFormatterTests 8 | { 9 | [Fact] 10 | public void MoreThanTwoItems() 11 | { 12 | var collection = new List(new[] {1, 2, 3}); 13 | var humanized = "1, 2 och 3"; 14 | Assert.Equal(humanized, collection.Humanize()); 15 | } 16 | 17 | [Fact] 18 | public void OneItem() 19 | { 20 | var collection = new List(new[] {1}); 21 | var humanized = "1"; 22 | Assert.Equal(humanized, collection.Humanize()); 23 | } 24 | 25 | [Fact] 26 | public void TwoItems() 27 | { 28 | var collection = new List(new[] {1, 2}); 29 | var humanized = "1 och 2"; 30 | Assert.Equal(humanized, collection.Humanize()); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Humanizer/GrammaticalCase.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Options for specifying the desired grammatical case for the output words 5 | /// 6 | public enum GrammaticalCase 7 | { 8 | /// 9 | /// Indicates the subject of a finite verb 10 | /// 11 | Nominative, 12 | /// 13 | /// Indicates the possessor of another noun 14 | /// 15 | Genitive, 16 | /// 17 | /// Indicates the indirect object of a verb 18 | /// 19 | Dative, 20 | /// 21 | /// Indicates the direct object of a verb 22 | /// 23 | Accusative, 24 | /// 25 | /// Indicates an object used in performing an action 26 | /// 27 | Instrumental, 28 | /// 29 | /// Indicates the object of a preposition 30 | /// 31 | Prepositional, 32 | } 33 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/NumberToWords/FrenchBelgianNumberToWordsConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Humanizer.Localisation.NumberToWords 5 | { 6 | internal class FrenchBelgianNumberToWordsConverter : FrenchNumberToWordsConverterBase 7 | { 8 | protected override void CollectPartsUnderAHundred(ICollection parts, ref int number, GrammaticalGender gender, bool pluralize) 9 | { 10 | if (number == 80) 11 | parts.Add(pluralize ? "quatre-vingts" : "quatre-vingt"); 12 | else if (number == 81) 13 | parts.Add(gender == GrammaticalGender.Feminine ? "quatre-vingt-une" : "quatre-vingt-un"); 14 | else 15 | base.CollectPartsUnderAHundred(parts, ref number, gender, pluralize); 16 | } 17 | 18 | protected override string GetTens(int tens) 19 | { 20 | if (tens == 8) 21 | return "quatre-vingt"; 22 | 23 | return base.GetTens(tens); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/it/CollectionFormatterTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.Localisation.it 5 | { 6 | [UseCulture("it")] 7 | public class CollectionFormatterTests 8 | { 9 | 10 | [Fact] 11 | public void OneItem() 12 | { 13 | var collection = new List(new int[] {1}); 14 | var humanized = "1"; 15 | Assert.Equal(humanized, collection.Humanize()); 16 | } 17 | 18 | [Fact] 19 | public void TwoItems() 20 | { 21 | var collection = new List(new int[] {1, 2}); 22 | var humanized = "1 e 2"; 23 | Assert.Equal(humanized, collection.Humanize()); 24 | } 25 | 26 | [Fact] 27 | public void MoreThanTwoItems() 28 | { 29 | var collection = new List(new int[] {1, 2, 3}); 30 | var humanized = "1, 2 e 3"; 31 | Assert.Equal(humanized, collection.Humanize()); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/de/CollectionFormatterTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.Localisation.de 5 | { 6 | [UseCulture("de")] 7 | public class CollectionFormatterTests 8 | { 9 | 10 | [Fact] 11 | public void OneItem() 12 | { 13 | var collection = new List(new int[] {1}); 14 | var humanized = "1"; 15 | Assert.Equal(humanized, collection.Humanize()); 16 | } 17 | 18 | [Fact] 19 | public void TwoItems() 20 | { 21 | var collection = new List(new int[] {1, 2}); 22 | var humanized = "1 und 2"; 23 | Assert.Equal(humanized, collection.Humanize()); 24 | } 25 | 26 | [Fact] 27 | public void MoreThanTwoItems() 28 | { 29 | var collection = new List(new int[] {1, 2, 3}); 30 | var humanized = "1, 2 und 3"; 31 | Assert.Equal(humanized, collection.Humanize()); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.af.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.af 5 | $version$ 6 | Humanizer Locale (af) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (af) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | af 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.ar.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.ar 5 | $version$ 6 | Humanizer Locale (ar) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (ar) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | ar 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.bg.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.bg 5 | $version$ 6 | Humanizer Locale (bg) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (bg) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | bg 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.cs.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.cs 5 | $version$ 6 | Humanizer Locale (cs) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (cs) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | cs 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.da.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.da 5 | $version$ 6 | Humanizer Locale (da) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (da) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | da 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.de.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.de 5 | $version$ 6 | Humanizer Locale (de) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (de) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | de 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.el.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.el 5 | $version$ 6 | Humanizer Locale (el) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (el) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | el 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.es.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.es 5 | $version$ 6 | Humanizer Locale (es) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (es) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | es 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.fa.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.fa 5 | $version$ 6 | Humanizer Locale (fa) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (fa) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | fa 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.fr.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.fr 5 | $version$ 6 | Humanizer Locale (fr) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (fr) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | fr 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.he.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.he 5 | $version$ 6 | Humanizer Locale (he) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (he) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | he 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.hr.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.hr 5 | $version$ 6 | Humanizer Locale (hr) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (hr) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | hr 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.hu.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.hu 5 | $version$ 6 | Humanizer Locale (hu) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (hu) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | hu 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.id.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.id 5 | $version$ 6 | Humanizer Locale (id) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (id) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | id 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.it.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.it 5 | $version$ 6 | Humanizer Locale (it) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (it) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | it 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.ja.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.ja 5 | $version$ 6 | Humanizer Locale (ja) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (ja) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | ja 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.lv.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.lv 5 | $version$ 6 | Humanizer Locale (lv) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (lv) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | lv 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.nb.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.nb 5 | $version$ 6 | Humanizer Locale (nb) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (nb) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | nb 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.nl.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.nl 5 | $version$ 6 | Humanizer Locale (nl) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (nl) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | nl 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.pl.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.pl 5 | $version$ 6 | Humanizer Locale (pl) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (pl) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | pl 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.pt.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.pt 5 | $version$ 6 | Humanizer Locale (pt) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (pt) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | pt 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.ro.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.ro 5 | $version$ 6 | Humanizer Locale (ro) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (ro) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | ro 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.ru.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.ru 5 | $version$ 6 | Humanizer Locale (ru) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (ru) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | ru 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.sk.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.sk 5 | $version$ 6 | Humanizer Locale (sk) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (sk) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | sk 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.sl.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.sl 5 | $version$ 6 | Humanizer Locale (sl) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (sl) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | sl 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.sr.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.sr 5 | $version$ 6 | Humanizer Locale (sr) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (sr) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | sr 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.sv.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.sv 5 | $version$ 6 | Humanizer Locale (sv) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (sv) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | sv 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.tr.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.tr 5 | $version$ 6 | Humanizer Locale (tr) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (tr) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | tr 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.uk.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.uk 5 | $version$ 6 | Humanizer Locale (uk) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (uk) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | uk 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.vi.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.vi 5 | $version$ 6 | Humanizer Locale (vi) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (vi) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | vi 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/ro-Ro/CollectionFormatterTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.Localisation.roRO 5 | { 6 | [UseCulture("ro-RO")] 7 | public class CollectionFormatterTests 8 | { 9 | 10 | [Fact] 11 | public void OneItem() 12 | { 13 | var collection = new List(new int[] { 1 }); 14 | var humanized = "1"; 15 | Assert.Equal(humanized, collection.Humanize()); 16 | } 17 | 18 | [Fact] 19 | public void TwoItems() 20 | { 21 | var collection = new List(new int[] { 1, 2 }); 22 | var humanized = "1 și 2"; 23 | Assert.Equal(humanized, collection.Humanize()); 24 | } 25 | 26 | [Fact] 27 | public void MoreThanTwoItems() 28 | { 29 | var collection = new List(new int[] { 1, 2, 3 }); 30 | var humanized = "1, 2 și 3"; 31 | Assert.Equal(humanized, collection.Humanize()); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Runtime.InteropServices.WindowsRuntime; 7 | using Windows.ApplicationModel; 8 | using Windows.ApplicationModel.Activation; 9 | using Windows.Foundation; 10 | using Windows.Foundation.Collections; 11 | using Windows.UI.Xaml; 12 | using Windows.UI.Xaml.Controls; 13 | using Windows.UI.Xaml.Controls.Primitives; 14 | using Windows.UI.Xaml.Data; 15 | using Windows.UI.Xaml.Input; 16 | using Windows.UI.Xaml.Media; 17 | using Windows.UI.Xaml.Navigation; 18 | using Xunit.Runners.UI; 19 | 20 | namespace Humanizer.Tests.Uwp.Runner 21 | { 22 | /// 23 | /// Provides application-specific behavior to supplement the default Application class. 24 | /// 25 | sealed partial class App : RunnerApplication 26 | { 27 | protected override void OnInitializeRunner() 28 | { 29 | AddTestAssembly(typeof(App).GetTypeInfo().Assembly); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/UkrainianOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Ordinalizers 2 | { 3 | internal class UkrainianOrdinalizer : DefaultOrdinalizer 4 | { 5 | public override string Convert(int number, string numberString) 6 | { 7 | return Convert(number, numberString, GrammaticalGender.Masculine); 8 | } 9 | 10 | public override string Convert(int number, string numberString, GrammaticalGender gender) 11 | { 12 | 13 | if (gender == GrammaticalGender.Masculine) 14 | return numberString + "-й"; 15 | 16 | if (gender == GrammaticalGender.Feminine) 17 | { 18 | if (number % 10 == 3) 19 | return numberString + "-я"; 20 | return numberString + "-а"; 21 | } 22 | 23 | if (gender == GrammaticalGender.Neuter) 24 | if (number % 10 == 3) 25 | return numberString + "-є"; 26 | 27 | return numberString + "-е"; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Humanizer/Configuration/CollectionFormatterRegistry.cs: -------------------------------------------------------------------------------- 1 | using Humanizer.Localisation.CollectionFormatters; 2 | 3 | namespace Humanizer.Configuration 4 | { 5 | internal class CollectionFormatterRegistry : LocaliserRegistry 6 | { 7 | public CollectionFormatterRegistry() 8 | : base(new DefaultCollectionFormatter("&")) 9 | { 10 | Register("en", new OxfordStyleCollectionFormatter("and")); 11 | Register("it", new DefaultCollectionFormatter("e")); 12 | Register("de", new DefaultCollectionFormatter("und")); 13 | Register("dk", new DefaultCollectionFormatter("og")); 14 | Register("nl", new DefaultCollectionFormatter("en")); 15 | Register("pt", new DefaultCollectionFormatter("e")); 16 | Register("ro", new DefaultCollectionFormatter("și")); 17 | Register("nn", new DefaultCollectionFormatter("og")); 18 | Register("nb", new DefaultCollectionFormatter("og")); 19 | Register("sv", new DefaultCollectionFormatter("och")); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.bn-BD.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.bn-BD 5 | $version$ 6 | Humanizer Locale (bn-BD) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (bn-BD) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | bn-BD 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.fi-FI.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.fi-FI 5 | $version$ 6 | Humanizer Locale (fi-FI) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (fi-FI) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | fi-FI 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.fr-BE.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.fr-BE 5 | $version$ 6 | Humanizer Locale (fr-BE) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (fr-BE) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | fr-BE 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.ko-KR.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.ko-KR 5 | $version$ 6 | Humanizer Locale (ko-KR) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (ko-KR) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | ko-KR 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.ms-MY.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.ms-MY 5 | $version$ 6 | Humanizer Locale (ms-MY) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (ms-MY) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | ms-MY 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.nb-NO.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.nb-NO 5 | $version$ 6 | Humanizer Locale (nb-NO) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (nb-NO) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | nb-NO 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.th-TH.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.th-TH 5 | $version$ 6 | Humanizer Locale (th-TH) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (th-TH) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | th-TH 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.zh-CN.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.zh-CN 5 | $version$ 6 | Humanizer Locale (zh-CN) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (zh-CN) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | zh-CN 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.fil-PH.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.fil-PH 5 | $version$ 6 | Humanizer Locale (fil-PH) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (fil-PH) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | fil-PH 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.sr-Latn.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.sr-Latn 5 | $version$ 6 | Humanizer Locale (sr-Latn) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (sr-Latn) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | sr-Latn 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.zh-Hans.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.zh-Hans 5 | $version$ 6 | Humanizer Locale (zh-Hans) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (zh-Hans) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | zh-Hans 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.zh-Hant.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.zh-Hant 5 | $version$ 6 | Humanizer Locale (zh-Hant) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (zh-Hant) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | zh-Hant 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/FluentDate/InTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.FluentDate 5 | { 6 | public class InTests 7 | { 8 | [Fact] 9 | public void InJanuary() 10 | { 11 | Assert.Equal(new DateTime(DateTime.Now.Year, 1, 1), In.January); 12 | } 13 | 14 | [Fact] 15 | public void InJanuaryOf2009() 16 | { 17 | Assert.Equal(new DateTime(2009, 1, 1), In.JanuaryOf(2009)); 18 | } 19 | 20 | [Fact] 21 | public void InFebruary() 22 | { 23 | Assert.Equal(new DateTime(DateTime.Now.Year, 2, 1), In.February); 24 | } 25 | 26 | [Fact] 27 | public void InTheYear() 28 | { 29 | Assert.Equal(new DateTime(2009, 1, 1), In.TheYear(2009)); 30 | } 31 | 32 | [Fact] 33 | public void InFiveDays() 34 | { 35 | var baseDate = On.January.The21st; 36 | var date = In.Five.DaysFrom(baseDate); 37 | Assert.Equal(baseDate.AddDays(5), date); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Here is a checklist you should tick through before submitting a pull request: 2 | - [ ] Implementation is clean 3 | - [ ] Code adheres to the existing coding standards; e.g. no curlies for one-line blocks, no redundant empty lines between methods or code blocks, spaces rather than tabs, etc. 4 | - [ ] No ReSharper warnings 5 | - [ ] There is proper unit test coverage 6 | - [ ] If the code is copied from StackOverflow (or a blog or OSS) full disclosure is included. That includes required license files and/or file headers explaining where the code came from with proper attribution 7 | - [ ] There are very few or no comments (because comments shouldn't be needed if you write clean code) 8 | - [ ] Xml documentation is added/updated for the addition/change 9 | - [ ] Your PR is (re)based on top of the latest commits from the `dev` branch (more info below) 10 | - [ ] Link to the issue(s) you're fixing from your PR description. Use `fixes #` 11 | - [ ] Readme is updated if you change an existing feature or add a new one 12 | - [ ] Run either `build.cmd` or `build.ps1` and ensure there are no test failures 13 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.uz-Cyrl-UZ.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.uz-Cyrl-UZ 5 | $version$ 6 | Humanizer Locale (uz-Cyrl-UZ) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (uz-Cyrl-UZ) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | uz-Cyrl-UZ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.uz-Latn-UZ.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core.uz-Latn-UZ 5 | $version$ 6 | Humanizer Locale (uz-Latn-UZ) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer Locale (uz-Latn-UZ) 13 | Copyright 2012-2015 Mehdi Khalili 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | uz-Latn-UZ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Resources.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Reflection; 3 | using System.Resources; 4 | 5 | namespace Humanizer.Localisation 6 | { 7 | /// 8 | /// Provides access to the resources of Humanizer 9 | /// 10 | public static class Resources 11 | { 12 | static readonly ResourceManager ResourceManager = new ResourceManager("Humanizer.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly); 13 | 14 | /// 15 | /// Returns the value of the specified string resource 16 | /// 17 | /// The name of the resource to retrieve. 18 | /// The culture of the resource to retrieve. If not specified, current thread's UI culture is used. 19 | /// The value of the resource localized for the specified culture. 20 | public static string GetResource(string resourceKey, CultureInfo culture = null) 21 | { 22 | return ResourceManager.GetString(resourceKey, culture); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Humanizer/Truncation/Truncator.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Gets a ITruncator 5 | /// 6 | public static class Truncator 7 | { 8 | /// 9 | /// Fixed length truncator 10 | /// 11 | public static ITruncator FixedLength 12 | { 13 | get 14 | { 15 | return new FixedLengthTruncator(); 16 | } 17 | } 18 | 19 | /// 20 | /// Fixed number of characters truncator 21 | /// 22 | public static ITruncator FixedNumberOfCharacters 23 | { 24 | get 25 | { 26 | return new FixedNumberOfCharactersTruncator(); 27 | } 28 | } 29 | 30 | /// 31 | /// Fixed number of words truncator 32 | /// 33 | public static ITruncator FixedNumberOfWords 34 | { 35 | get 36 | { 37 | return new FixedNumberOfWordsTruncator(); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/NumberToWords/ItalianNumberToWordsConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Humanizer.Localisation.NumberToWords.Italian; 3 | 4 | namespace Humanizer.Localisation.NumberToWords 5 | { 6 | internal class ItalianNumberToWordsConverter : GenderedNumberToWordsConverter 7 | { 8 | public override string Convert(long input, GrammaticalGender gender) 9 | { 10 | if (input > Int32.MaxValue || input < Int32.MinValue) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | var number = (int)input; 15 | 16 | if (number < 0) 17 | return "meno " + Convert(Math.Abs(number), gender); 18 | 19 | var cruncher = new ItalianCardinalNumberCruncher(number, gender); 20 | 21 | return cruncher.Convert(); 22 | } 23 | 24 | public override string ConvertToOrdinal(int number, GrammaticalGender gender) 25 | { 26 | var cruncher = new ItalianOrdinalNumberCruncher(number, gender); 27 | 28 | return cruncher.Convert(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/StringDehumanizeTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Humanizer.Tests 4 | { 5 | public class StringDehumanizeTests 6 | { 7 | [Theory] 8 | [InlineData("Pascal case sentence is camelized", "PascalCaseSentenceIsCamelized")] 9 | [InlineData("Title Case Sentence Is Camelized", "TitleCaseSentenceIsCamelized")] 10 | [InlineData("Mixed case sentence Is Camelized", "MixedCaseSentenceIsCamelized")] 11 | [InlineData("lower case sentence is camelized", "LowerCaseSentenceIsCamelized")] 12 | [InlineData("AlreadyDehumanizedStringIsUntouched", "AlreadyDehumanizedStringIsUntouched")] 13 | [InlineData("", "")] 14 | [InlineData("A special character is removed?", "ASpecialCharacterIsRemoved")] 15 | [InlineData("A special character is removed after a space ?", "ASpecialCharacterIsRemovedAfterASpace")] 16 | [InlineData("Internal special characters ?)@ are removed", "InternalSpecialCharactersAreRemoved")] 17 | public void CanDehumanizeIntoAPascalCaseWord(string input, string expectedResult) 18 | { 19 | Assert.Equal(expectedResult, input.Dehumanize()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Humanizer.Tests.Shared.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | fdec244b-f07e-4a5e-bb80-fbc6ac77a9aa 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Humanizer.Tests.Uwp.Runner")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Humanizer.Tests.Uwp.Runner")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/Humanizer/Truncation/FixedLengthTruncator.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer 2 | { 3 | /// 4 | /// Truncate a string to a fixed length 5 | /// 6 | class FixedLengthTruncator : ITruncator 7 | { 8 | public string Truncate(string value, int length, string truncationString, TruncateFrom truncateFrom = TruncateFrom.Right) 9 | { 10 | if (value == null) 11 | return null; 12 | 13 | if (value.Length == 0) 14 | return value; 15 | 16 | if (truncationString == null || truncationString.Length > length) 17 | return truncateFrom == TruncateFrom.Right 18 | ? value.Substring(0, length) 19 | : value.Substring(value.Length - length); 20 | 21 | 22 | if (truncateFrom == TruncateFrom.Left) 23 | return value.Length > length 24 | ? truncationString + value.Substring(value.Length - length + truncationString.Length) 25 | : value; 26 | 27 | return value.Length > length 28 | ? value.Substring(0, length - truncationString.Length) + truncationString 29 | : value; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Humanizer.Localisation.NumberToWords 4 | { 5 | class FrenchNumberToWordsConverter : FrenchNumberToWordsConverterBase 6 | { 7 | protected override void CollectPartsUnderAHundred(ICollection parts, ref int number, GrammaticalGender gender, bool pluralize) 8 | { 9 | if (number == 71) 10 | parts.Add("soixante et onze"); 11 | else if (number == 80) 12 | parts.Add(pluralize ? "quatre-vingts" : "quatre-vingt"); 13 | else if (number >= 70) 14 | { 15 | var @base = number < 80 ? 60 : 80; 16 | int units = number - @base; 17 | var tens = @base/10; 18 | parts.Add($"{GetTens(tens)}-{GetUnits(units, gender)}"); 19 | } 20 | else 21 | base.CollectPartsUnderAHundred(parts, ref number, gender, pluralize); 22 | } 23 | 24 | protected override string GetTens(int tens) 25 | { 26 | if (tens == 8) 27 | return "quatre-vingt"; 28 | 29 | return base.GetTens(tens); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Humanizer.Tests.Uwp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Humanizer.Tests.Uwp")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | [assembly: AssemblyMetadata("TargetPlatform","UAP")] 17 | 18 | // Version information for an assembly consists of the following four values: 19 | // 20 | // Major Version 21 | // Minor Version 22 | // Build Number 23 | // Revision 24 | // 25 | // You can specify all the values or you can default the Build and Revision Numbers 26 | // by using the '*' as shown below: 27 | // [assembly: AssemblyVersion("1.0.*")] 28 | [assembly: AssemblyVersion("1.0.0.0")] 29 | [assembly: AssemblyFileVersion("1.0.0.0")] 30 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/Humanizer/CasingExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Humanizer 4 | { 5 | /// 6 | /// ApplyCase method to allow changing the case of a sentence easily 7 | /// 8 | public static class CasingExtensions 9 | { 10 | /// 11 | /// Changes the casing of the provided input 12 | /// 13 | /// 14 | /// 15 | /// 16 | public static string ApplyCase(this string input, LetterCasing casing) 17 | { 18 | switch (casing) 19 | { 20 | case LetterCasing.Title: 21 | return input.Transform(To.TitleCase); 22 | 23 | case LetterCasing.LowerCase: 24 | return input.Transform(To.LowerCase); 25 | 26 | case LetterCasing.AllCaps: 27 | return input.Transform(To.UpperCase); 28 | 29 | case LetterCasing.Sentence: 30 | return input.Transform(To.SentenceCase); 31 | 32 | default: 33 | throw new ArgumentOutOfRangeException(nameof(casing)); 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/Humanizer/FluentDate/In.Months.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="true" hostSpecific="true" #> 2 | <#@ output extension=".cs" #> 3 | <#@ Assembly Name="System.Core" #> 4 | <#@ Assembly Name="System.Windows.Forms" #> 5 | <#@ import namespace="System" #> 6 | <#@ import namespace="System.IO" #> 7 | <#@ import namespace="System.Diagnostics" #> 8 | <#@ import namespace="System.Linq" #> 9 | <#@ import namespace="System.Collections" #> 10 | <#@ import namespace="System.Collections.Generic" #> 11 | using System; 12 | 13 | namespace Humanizer 14 | { 15 | public partial class In 16 | { 17 | <#var now = DateTime.Now; 18 | for (int i = 0; i < 12; i++){ 19 | var monthName = new DateTime(now.Year, i + 1, 1).ToString("MMMM"); 20 | #> 21 | /// 22 | /// Returns 1st of <#= monthName #> of the current year 23 | /// 24 | public static DateTime <#= monthName #> 25 | { 26 | get { return new DateTime(DateTime.UtcNow.Year, <#= i + 1 #>, 1); } 27 | } 28 | 29 | /// 30 | /// Returns 1st of <#= monthName #> of the year passed in 31 | /// 32 | public static DateTime <#= monthName#>Of(int year) 33 | { 34 | return new DateTime(year, <#= i + 1 #>, 1); 35 | } 36 | <# 37 | } 38 | 39 | #> 40 | } 41 | } -------------------------------------------------------------------------------- /NuSpecs/Humanizer.Core.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Humanizer.Core 5 | $version$ 6 | Humanizer Locale (en) 7 | Mehdi Khalili, Oren Novotny 8 | Mehdi Khalili, onovotny 9 | https://github.com/Humanizr/Humanizer 10 | https://raw.github.com/Humanizr/Humanizer/master/logo.png 11 | false 12 | Humanizer core package that contains the library and the neutral language (English) resources 13 | Copyright 2012-2016 14 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 15 | en 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Humanizer/DateTimeHumanizeStrategy/PrecisionDateTimeHumanizeStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Humanizer.DateTimeHumanizeStrategy 5 | { 6 | /// 7 | /// Precision-based calculator for distance between two times 8 | /// 9 | public class PrecisionDateTimeHumanizeStrategy : IDateTimeHumanizeStrategy 10 | { 11 | private readonly double _precision; 12 | 13 | /// 14 | /// Constructs a precision-based calculator for distance of time with default precision 0.75. 15 | /// 16 | /// precision of approximation, if not provided 0.75 will be used as a default precision. 17 | public PrecisionDateTimeHumanizeStrategy(double precision = .75) 18 | { 19 | _precision = precision; 20 | } 21 | 22 | /// 23 | /// Returns localized & humanized distance of time between two dates; given a specific precision. 24 | /// 25 | public string Humanize(DateTime input, DateTime comparisonBase, CultureInfo culture) 26 | { 27 | return DateTimeHumanizeAlgorithms.PrecisionHumanize(input, comparisonBase, _precision, culture); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.cs: -------------------------------------------------------------------------------- 1 | #if NET46 2 | using System.IO; 3 | using ApiApprover; 4 | using ApprovalTests; 5 | using ApprovalTests.Reporters; 6 | using Mono.Cecil; 7 | using Xunit; 8 | 9 | namespace Humanizer.Tests.ApiApprover 10 | { 11 | 12 | public class PublicApiApprovalTest 13 | { 14 | [Fact] 15 | [UseCulture("en-US")] 16 | [UseReporter(typeof(DiffReporter))] 17 | [IgnoreLineEndings(true)] 18 | public void approve_public_api() 19 | { 20 | var assemblyPath = typeof(StringHumanizeExtensions).Assembly.Location; 21 | 22 | var assemblyResolver = new DefaultAssemblyResolver(); 23 | assemblyResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath)); 24 | 25 | var readSymbols = File.Exists(Path.ChangeExtension(assemblyPath, ".pdb")); 26 | var asm = AssemblyDefinition.ReadAssembly(assemblyPath, new ReaderParameters(ReadingMode.Deferred) 27 | { 28 | ReadSymbols = readSymbols, 29 | AssemblyResolver = assemblyResolver 30 | }); 31 | 32 | var publicApi = PublicApiGenerator.CreatePublicApiForAssembly(asm); 33 | Approvals.Verify(publicApi); 34 | } 35 | } 36 | } 37 | #endif -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/BitFieldEnumUnderTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Humanizer.Tests 10 | { 11 | [Flags] 12 | public enum BitFieldEnumUnderTest : int 13 | { 14 | [Display( Description = BitFlagEnumTestsResources.MemberWithSingleWordDisplayAttribute)] 15 | RED = 1, 16 | [Display( Description = BitFlagEnumTestsResources.MemberWithMultipleWordDisplayAttribute)] 17 | DARK_GRAY = 2 18 | } 19 | 20 | [Flags] 21 | public enum ShortBitFieldEnumUnderTest : short 22 | { 23 | [Display( Description = BitFlagEnumTestsResources.MemberWithSingleWordDisplayAttribute)] 24 | RED = 1, 25 | [Display( Description = BitFlagEnumTestsResources.MemberWithMultipleWordDisplayAttribute)] 26 | DARK_GRAY = 2 27 | } 28 | 29 | public class BitFlagEnumTestsResources 30 | { 31 | public const string MemberWithSingleWordDisplayAttribute = "Red"; 32 | public const string MemberWithMultipleWordDisplayAttribute = "Dark Gray"; 33 | 34 | public const string ExpectedResultWhenBothValuesXored = "Red and Dark Gray"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Ordinalizers/RomanianOrdinalizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Humanizer.Localisation.Ordinalizers 5 | { 6 | 7 | internal class RomanianOrdinalizer : DefaultOrdinalizer 8 | { 9 | public override string Convert(int number, string numberString) 10 | { 11 | return Convert(number, numberString, GrammaticalGender.Masculine); 12 | } 13 | 14 | public override string Convert(int number, string numberString, GrammaticalGender gender) 15 | { 16 | // No ordinal for 0 (zero) in Romanian. 17 | if (number == 0) 18 | { 19 | return "0"; 20 | } 21 | 22 | // Exception from the rule. 23 | if (number == 1) 24 | { 25 | if (gender == GrammaticalGender.Feminine) 26 | { 27 | return "prima"; // întâia 28 | } 29 | 30 | return "primul"; // întâiul 31 | } 32 | 33 | if (gender == GrammaticalGender.Feminine) 34 | { 35 | return string.Format("a {0}-a", numberString); 36 | } 37 | 38 | return string.Format("al {0}-lea", numberString); 39 | 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/invariant/NumberToWordsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.Localisation.invariant 5 | { 6 | [UseCulture("")] 7 | public class NumberToWordsTests 8 | { 9 | 10 | [Theory] 11 | [InlineData(1)] 12 | [InlineData(10)] 13 | [InlineData(11)] 14 | [InlineData(122)] 15 | [InlineData(3501)] 16 | [InlineData(100)] 17 | [InlineData(1000)] 18 | [InlineData(100000)] 19 | [InlineData(1000000)] 20 | [InlineData(10000000)] 21 | [InlineData(100000000)] 22 | [InlineData(1000000000)] 23 | [InlineData(111)] 24 | [InlineData(1111)] 25 | [InlineData(111111)] 26 | [InlineData(1111111)] 27 | [InlineData(11111111)] 28 | [InlineData(111111111)] 29 | [InlineData(1111111111)] 30 | [InlineData(123)] 31 | [InlineData(1234)] 32 | [InlineData(12345)] 33 | [InlineData(123456)] 34 | [InlineData(1234567)] 35 | [InlineData(12345678)] 36 | [InlineData(123456789)] 37 | [InlineData(1234567890)] 38 | public void ToWords(int number) 39 | { 40 | Assert.Equal(number.ToString(), number.ToWords()); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/NumberToWords/DefaultNumberToWordsConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace Humanizer.Localisation.NumberToWords 4 | { 5 | internal class DefaultNumberToWordsConverter : GenderlessNumberToWordsConverter 6 | { 7 | private readonly CultureInfo _culture; 8 | 9 | /// 10 | /// Constructor. 11 | /// 12 | /// Culture to use. 13 | public DefaultNumberToWordsConverter(CultureInfo culture) 14 | { 15 | _culture = culture; 16 | } 17 | 18 | /// 19 | /// 3501.ToWords() -> "three thousand five hundred and one" 20 | /// 21 | /// Number to be turned to words 22 | /// 23 | public override string Convert(long number) 24 | { 25 | return number.ToString(_culture); 26 | } 27 | 28 | /// 29 | /// 1.ToOrdinalWords() -> "first" 30 | /// 31 | /// Number to be turned to ordinal words 32 | /// 33 | public override string ConvertToOrdinal(int number) 34 | { 35 | return number.ToString(_culture); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/Humanizer/DateTimeHumanizeStrategy/PrecisionDateTimeOffsetHumanizeStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Humanizer.DateTimeHumanizeStrategy 5 | { 6 | /// 7 | /// Precision-based calculator for distance between two times 8 | /// 9 | public class PrecisionDateTimeOffsetHumanizeStrategy : IDateTimeOffsetHumanizeStrategy 10 | { 11 | private readonly double _precision; 12 | 13 | /// 14 | /// Constructs a precision-based calculator for distance of time with default precision 0.75. 15 | /// 16 | /// precision of approximation, if not provided 0.75 will be used as a default precision. 17 | public PrecisionDateTimeOffsetHumanizeStrategy(double precision = .75) 18 | { 19 | _precision = precision; 20 | } 21 | 22 | /// 23 | /// Returns localized & humanized distance of time between two dates; given a specific precision. 24 | /// 25 | public string Humanize(DateTimeOffset input, DateTimeOffset comparisonBase, CultureInfo culture) 26 | { 27 | return DateTimeHumanizeAlgorithms.PrecisionHumanize(input.UtcDateTime, comparisonBase.UtcDateTime, _precision, culture); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Humanizer/DateToOrdinalWordsExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Humanizer.Configuration; 4 | 5 | namespace Humanizer 6 | { 7 | /// 8 | /// Humanizes DateTime into human readable sentence 9 | /// 10 | public static class DateToOrdinalWordsExtensions 11 | { 12 | /// 13 | /// Turns the provided date into ordinal words 14 | /// 15 | /// The date to be made into ordinal words 16 | /// The date in ordinal words 17 | public static string ToOrdinalWords(this DateTime input) 18 | { 19 | return Configurator.DateToOrdinalWordsConverter.Convert(input); 20 | } 21 | /// 22 | /// Turns the provided date into ordinal words 23 | /// 24 | /// The date to be made into ordinal words 25 | /// The grammatical case to use for output words 26 | /// The date in ordinal words 27 | public static string ToOrdinalWords(this DateTime input, GrammaticalCase grammaticalCase) 28 | { 29 | return Configurator.DateToOrdinalWordsConverter.Convert(input, grammaticalCase); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Humanizer/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Humanizer 4 | { 5 | /// 6 | /// Extension methods for String type. 7 | /// 8 | public static class StringExtensions 9 | { 10 | /// 11 | /// Extension method to format string with passed arguments. Current thread's current culture is used 12 | /// 13 | /// string format 14 | /// arguments 15 | /// 16 | public static string FormatWith(this string format, params object[] args) 17 | { 18 | return string.Format(format, args); 19 | } 20 | 21 | /// 22 | /// Extension method to format string with passed arguments using specified format provider (i.e. CultureInfo) 23 | /// 24 | /// string format 25 | /// An object that supplies culture-specific formatting information 26 | /// arguments 27 | /// 28 | public static string FormatWith(this string format, IFormatProvider provider, params object[] args) 29 | { 30 | return string.Format(provider, format, args); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Humanizer/Humanizer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard1.0 4 | Mehdi Khalili, Oren Novotny 5 | https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE 6 | https://github.com/Humanizr/Humanizer 7 | 2.12 8 | A micro-framework that turns your normal strings, type names, enum fields, date fields ETC into a human friendly format 9 | Copyright © 2012-2017 Mehdi Khalili 10 | Humanizer ($(TargetFramework)) 11 | true 12 | true 13 | Humanizer.snk 14 | embedded 15 | latest 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |

@ViewBag.Message

8 |
9 | 10 |
11 |
12 |

Phone:

13 |
14 |

15 | Main: 16 | 425.555.0100 17 |

18 |

19 | After Hours: 20 | 425.555.0199 21 |

22 |
23 | 24 |
25 |
26 |

Email:

27 |
28 |

29 | Support: 30 | Support@example.com 31 |

32 |

33 | Marketing: 34 | Marketing@example.com 35 |

36 |

37 | General: 38 | General@example.com 39 |

40 |
41 | 42 |
43 |
44 |

Address:

45 |
46 |

47 | One Microsoft Way
48 | Redmond, WA 98052-6399 49 |

50 |
-------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Properties/UnitTestApp.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp.Runner/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Views/Account/Login.cshtml: -------------------------------------------------------------------------------- 1 | @model Humanizer.MvcSample.Models.LoginModel 2 | 3 | @{ 4 | ViewBag.Title = "Log in"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Enter your user name and password below.

10 |
11 | 12 | 13 | 14 | 15 | @using (Html.BeginForm((string)ViewBag.FormAction, "Account")) { 16 | @Html.ValidationSummary(true, "Log in was unsuccessful. Please correct the errors and try again.") 17 | 18 |
19 | Log in Form 20 |
    21 |
  1. 22 | @Html.LabelFor(m => m.UserName) 23 | @Html.TextBoxFor(m => m.UserName) 24 | @Html.ValidationMessageFor(m => m.UserName) 25 |
  2. 26 |
  3. 27 | @Html.LabelFor(m => m.Password) 28 | @Html.PasswordFor(m => m.Password) 29 | @Html.ValidationMessageFor(m => m.Password) 30 |
  4. 31 |
  5. 32 | @Html.CheckBoxFor(m => m.RememberMe) 33 | @Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" }) 34 |
  6. 35 |
36 | 37 |
38 |

39 | @Html.ActionLink("Register", "Register") if you don't have an account. 40 |

41 | } 42 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation 2 | { 3 | public partial class ResourceKeys 4 | { 5 | /// 6 | /// Encapsulates the logic required to get the resource keys for TimeSpan.Humanize 7 | /// 8 | public static class TimeSpanHumanize 9 | { 10 | /// 11 | /// Examples: TimeSpanHumanize_SingleMinute, TimeSpanHumanize_MultipleHours. 12 | /// Note: "s" for plural served separately by third part. 13 | /// 14 | private const string TimeSpanFormat = "TimeSpanHumanize_{0}{1}{2}"; 15 | private const string Zero = "TimeSpanHumanize_Zero"; 16 | 17 | /// 18 | /// Generates Resource Keys according to convention. 19 | /// 20 | /// Time unit, . 21 | /// Number of units, default is One. 22 | /// Resource key, like TimeSpanHumanize_SingleMinute 23 | public static string GetResourceKey(TimeUnit unit, int count = 1) 24 | { 25 | ValidateRange(count); 26 | 27 | if (count == 0) 28 | return Zero; 29 | 30 | return TimeSpanFormat.FormatWith(count == 1 ? Single : Multiple, unit, count == 1 ? "" : "s"); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/jquery.ui.accordion.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Accordion 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Accordion#theming 14 | */ 15 | /* IE/Win - Fix animation bug - #4615 */ 16 | .ui-accordion { width: 100%; } 17 | .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } 18 | .ui-accordion .ui-accordion-li-fix { display: inline; } 19 | .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } 20 | .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } 21 | .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } 22 | .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } 23 | .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } 24 | .ui-accordion .ui-accordion-content-active { display: block; } 25 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/StringExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Xunit; 4 | 5 | namespace Humanizer.Tests 6 | { 7 | public class StringExtensionsTests 8 | { 9 | private const string Format = "This is a format with three numbers: {0}-{1}-{2}."; 10 | private const string Expected = "This is a format with three numbers: 1-2-3."; 11 | 12 | [Fact] 13 | public void CanFormatStringWithExactNumberOfArguments() 14 | { 15 | Assert.Equal(Expected, Format.FormatWith(1, 2, 3)); 16 | } 17 | 18 | [Fact] 19 | public void CanFormatStringWithMoreArguments() 20 | { 21 | Assert.Equal(Expected, Format.FormatWith(1, 2, 3, 4, 5)); 22 | } 23 | 24 | [Fact] 25 | public void CannotFormatStringWithLessArguments() 26 | { 27 | Assert.Throws(() => Format.FormatWith(1, 2)); 28 | } 29 | 30 | [Fact] 31 | public void FormatCannotBeNull() 32 | { 33 | string format = null; 34 | Assert.Throws(() => format.FormatWith(1, 2)); 35 | } 36 | 37 | [Theory] 38 | [InlineData("en-US", "6,666.66")] 39 | [InlineData("ru-RU", "6 666,66")] 40 | public void CanSpecifyCultureExplicitly(string culture, string expected) 41 | { 42 | Assert.Equal(expected, "{0:N2}".FormatWith(new CultureInfo(culture), 6666.66)); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests/Humanizer.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net46;netcoreapp1.1 4 | 5 | 6 | 7 | $(DefineConstants);NETFX_CORE 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | %(RecursiveDir)%(Filename)%(Extension) 23 | 24 | 25 | 26 | 27 | 28 | PreserveNewest 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Humanizer.MvcSample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Humanizer.MvcSample")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d6f0a3c8-d4d2-4adf-8480-2689e4f83154")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/CollectionFormatters/ICollectionFormatter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Humanizer.Localisation.CollectionFormatters 5 | { 6 | /// 7 | /// An interface you should implement to localize Humanize for collections 8 | /// 9 | public interface ICollectionFormatter 10 | { 11 | /// 12 | /// Formats the collection for display, calling ToString() on each object. 13 | /// 14 | /// 15 | string Humanize(IEnumerable collection); 16 | 17 | /// 18 | /// Formats the collection for display, calling `objectFormatter` on each object. 19 | /// 20 | /// 21 | string Humanize(IEnumerable collection, Func objectFormatter); 22 | 23 | /// 24 | /// Formats the collection for display, calling ToString() on each object 25 | /// and using `separator` before the final item. 26 | /// 27 | /// 28 | string Humanize(IEnumerable collection, string separator); 29 | 30 | /// 31 | /// Formats the collection for display, calling `objectFormatter` on each object 32 | /// and using `separator` before the final item. 33 | /// 34 | /// 35 | string Humanize(IEnumerable collection, Func objectFormatter, string separator); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/NumberToWords/INumberToWordsConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.NumberToWords 2 | { 3 | /// 4 | /// An interface you should implement to localise ToWords and ToOrdinalWords methods 5 | /// 6 | public interface INumberToWordsConverter 7 | { 8 | /// 9 | /// Converts the number to string using the locale's default grammatical gender 10 | /// 11 | /// 12 | /// 13 | string Convert(long number); 14 | 15 | /// 16 | /// Converts the number to string using the provided grammatical gender 17 | /// 18 | /// 19 | /// 20 | /// 21 | string Convert(long number, GrammaticalGender gender); 22 | 23 | /// 24 | /// Converts the number to ordinal string using the locale's default grammatical gender 25 | /// 26 | /// 27 | /// 28 | string ConvertToOrdinal(int number); 29 | 30 | /// 31 | /// Converts the number to ordinal string using the provided grammatical gender 32 | /// 33 | /// 34 | /// 35 | /// 36 | string ConvertToOrdinal(int number, GrammaticalGender gender); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/NumberToWords/GenderlessNumberToWordsConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.NumberToWords 2 | { 3 | abstract class GenderlessNumberToWordsConverter : INumberToWordsConverter 4 | { 5 | /// 6 | /// Converts the number to string 7 | /// 8 | /// 9 | /// 10 | public abstract string Convert(long number); 11 | 12 | /// 13 | /// Converts the number to string ignoring the provided grammatical gender 14 | /// 15 | /// 16 | /// 17 | /// 18 | public string Convert(long number, GrammaticalGender gender) 19 | { 20 | return Convert(number); 21 | } 22 | 23 | /// 24 | /// Converts the number to ordinal string 25 | /// 26 | /// 27 | /// 28 | public abstract string ConvertToOrdinal(int number); 29 | 30 | /// 31 | /// Converts the number to ordinal string ignoring the provided grammatical gender 32 | /// 33 | /// 34 | /// 35 | /// 36 | public string ConvertToOrdinal(int number, GrammaticalGender gender) 37 | { 38 | return ConvertToOrdinal(number); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/EnumHumanizeWithCustomDescriptionPropertyNamesTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Humanizer.Configuration; 3 | using Xunit; 4 | 5 | namespace Humanizer.Tests 6 | { 7 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", 8 | Justification = "This is a test only class, and doesn't need a 'proper' IDisposable implementation.")] 9 | public class EnumHumanizeWithCustomDescriptionPropertyNamesTests : IDisposable 10 | { 11 | public EnumHumanizeWithCustomDescriptionPropertyNamesTests() 12 | { 13 | Configurator.EnumDescriptionPropertyLocator = p => p.Name == "Info"; 14 | } 15 | 16 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", 17 | Justification = "This is a test only class, and doesn't need a 'proper' IDisposable implementation.")] 18 | public void Dispose() 19 | { 20 | Configurator.EnumDescriptionPropertyLocator = null; 21 | } 22 | 23 | [Fact] 24 | public void HonorsCustomPropertyAttribute() 25 | { 26 | Assert.Equal(EnumTestsResources.MemberWithCustomPropertyAttribute, EnumUnderTest.MemberWithCustomPropertyAttribute.Humanize()); 27 | } 28 | 29 | [Fact] 30 | public void CanHumanizeMembersWithoutDescriptionAttribute() 31 | { 32 | Assert.Equal(EnumTestsResources.MemberWithoutDescriptionAttributeSentence, EnumUnderTest.MemberWithoutDescriptionAttribute.Humanize()); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/jquery.ui.slider.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Slider 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Slider#theming 14 | */ 15 | .ui-slider { position: relative; text-align: left; } 16 | .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } 17 | .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } 18 | 19 | .ui-slider-horizontal { height: .8em; } 20 | .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } 21 | .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } 22 | .ui-slider-horizontal .ui-slider-range-min { left: 0; } 23 | .ui-slider-horizontal .ui-slider-range-max { right: 0; } 24 | 25 | .ui-slider-vertical { width: .8em; height: 100px; } 26 | .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } 27 | .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } 28 | .ui-slider-vertical .ui-slider-range-min { bottom: 0; } 29 | .ui-slider-vertical .ui-slider-range-max { top: 0; } -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Localisation/hr/TimeSpanHumanizeTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | namespace Humanizer.Tests.Localisation.hr 5 | { 6 | [UseCulture("hr-HR")] 7 | public class TimeSpanHumanizeTests 8 | { 9 | 10 | [Theory] 11 | [Trait("Translation", "Google")] 12 | [InlineData(366, "1 godina")] 13 | [InlineData(731, "2 godine")] 14 | [InlineData(1096, "3 godine")] 15 | [InlineData(4018, "11 godina")] 16 | public void Years(int days, string expected) 17 | { 18 | Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Year)); 19 | } 20 | 21 | [Theory] 22 | [Trait("Translation", "Google")] 23 | [InlineData(31, "1 mjesec")] 24 | [InlineData(61, "2 mjeseca")] 25 | [InlineData(92, "3 mjeseca")] 26 | [InlineData(335, "11 mjeseci")] 27 | public void Months(int days, string expected) 28 | { 29 | Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Year)); 30 | } 31 | 32 | [Theory] 33 | [InlineData(1, "1 dan")] 34 | [InlineData(2, "2 dana")] 35 | [InlineData(3, "3 dana")] 36 | [InlineData(4, "4 dana")] 37 | [InlineData(5, "5 dana")] 38 | [InlineData(7, "1 tjedan")] 39 | [InlineData(14, "2 tjedna")] 40 | public void Days(int days, string expected) 41 | { 42 | Assert.Equal(expected, TimeSpan.FromDays(days).Humanize()); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/jquery.ui.resizable.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Resizable 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)] 12 | * 13 | * http://docs.jquery.com/UI/Resizable#theming 14 | */ 15 | .ui-resizable { position: relative;} 16 | .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} 17 | .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } 18 | .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } 19 | .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } 20 | .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } 21 | .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } 22 | .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } 23 | .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } 24 | .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } 25 | .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;} -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/HumanizerMetadataProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | using System.Web.Mvc; 7 | 8 | namespace Humanizer.MvcSample 9 | { 10 | public class HumanizerMetadataProvider : DataAnnotationsModelMetadataProvider 11 | { 12 | protected override ModelMetadata CreateMetadata( 13 | IEnumerable attributes, 14 | Type containerType, 15 | Func modelAccessor, 16 | Type modelType, 17 | string propertyName) 18 | { 19 | var propertyAttributes = attributes.ToList(); 20 | var modelMetadata = base.CreateMetadata(propertyAttributes, containerType, modelAccessor, modelType, propertyName); 21 | 22 | if (IsTransformRequired(modelMetadata, propertyAttributes)) 23 | modelMetadata.DisplayName = modelMetadata.PropertyName.Humanize(); 24 | 25 | return modelMetadata; 26 | } 27 | 28 | private static bool IsTransformRequired(ModelMetadata modelMetadata, IList propertyAttributes) 29 | { 30 | if (string.IsNullOrEmpty(modelMetadata.PropertyName)) 31 | return false; 32 | 33 | if (propertyAttributes.IsDefined(typeof(DisplayNameAttribute), true)) 34 | return false; 35 | 36 | if (propertyAttributes.IsDefined(typeof(DisplayAttribute), true)) 37 | return false; 38 | 39 | return true; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Views/Account/ChangePassword.cshtml: -------------------------------------------------------------------------------- 1 | @model Humanizer.MvcSample.Models.ChangePasswordModel 2 | 3 | @{ 4 | ViewBag.Title = "Change Password"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Use the form below to change your password.

10 |
11 | 12 |

13 | New passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length. 14 |

15 | 16 | 17 | 18 | 19 | @using (Html.BeginForm()) { 20 | @Html.ValidationSummary(true, "Password change was unsuccessful. Please correct the errors and try again.") 21 | 22 |
23 | Change Password Form 24 |
    25 |
  1. 26 | @Html.LabelFor(m => m.OldPassword) 27 | @Html.PasswordFor(m => m.OldPassword) 28 | @Html.ValidationMessageFor(m => m.OldPassword) 29 |
  2. 30 |
  3. 31 | @Html.LabelFor(m => m.NewPassword) 32 | @Html.PasswordFor(m => m.NewPassword) 33 | @Html.ValidationMessageFor(m => m.NewPassword) 34 |
  4. 35 |
  5. 36 | @Html.LabelFor(m => m.ConfirmPassword) 37 | @Html.PasswordFor(m => m.ConfirmPassword) 38 | @Html.ValidationMessageFor(m => m.ConfirmPassword) 39 |
  6. 40 |
41 | 42 |
43 | } 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2014 Mehdi Khalili 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | ============================================================================== 24 | 25 | Inflector (https://github.com/srkirkland/Inflector) 26 | The MIT License (MIT) 27 | Copyright (c) 2013 Scott Kirkland 28 | 29 | ============================================================================== 30 | 31 | ByteSize (https://github.com/omar/ByteSize) 32 | The MIT License (MIT) 33 | Copyright (c) 2013-2014 Omar Khudeira (http://omar.io) 34 | 35 | ============================================================================== 36 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using System.Web.Mvc; 3 | using System.Web.Optimization; 4 | using System.Web.Routing; 5 | 6 | namespace Humanizer.MvcSample 7 | { 8 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 9 | // visit http://go.microsoft.com/?LinkId=9394801 10 | 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 14 | { 15 | filters.Add(new HandleErrorAttribute()); 16 | } 17 | 18 | public static void RegisterRoutes(RouteCollection routes) 19 | { 20 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 21 | 22 | routes.MapHttpRoute( 23 | name: "DefaultApi", 24 | routeTemplate: "api/{controller}/{id}", 25 | defaults: new { id = RouteParameter.Optional } 26 | ); 27 | 28 | routes.MapRoute( 29 | name: "Default", 30 | url: "{controller}/{action}/{id}", 31 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 32 | ); 33 | } 34 | 35 | protected void Application_Start() 36 | { 37 | AreaRegistration.RegisterAllAreas(); 38 | 39 | RegisterGlobalFilters(GlobalFilters.Filters); 40 | RegisterRoutes(RouteTable.Routes); 41 | 42 | ModelMetadataProviders.Current = new HumanizerMetadataProvider(); 43 | 44 | BundleTable.Bundles.RegisterTemplateBundles(); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/Humanizer.Tests/App_Packages/ApiApprover.3.0.1/PublicApiApprover.cs: -------------------------------------------------------------------------------- 1 | #if NET46 2 | using System.IO; 3 | using ApprovalTests; 4 | using ApprovalTests.Namers; 5 | using Mono.Cecil; 6 | 7 | namespace ApiApprover 8 | { 9 | public static class PublicApiApprover 10 | { 11 | public static void ApprovePublicApi(string assemblyPath) 12 | { 13 | var assemblyResolver = new DefaultAssemblyResolver(); 14 | assemblyResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath)); 15 | 16 | var readSymbols = File.Exists(Path.ChangeExtension(assemblyPath, ".pdb")); 17 | var asm = AssemblyDefinition.ReadAssembly(assemblyPath, new ReaderParameters(ReadingMode.Deferred) 18 | { 19 | ReadSymbols = readSymbols, 20 | AssemblyResolver = assemblyResolver, 21 | }); 22 | 23 | var publicApi = PublicApiGenerator.CreatePublicApiForAssembly(asm); 24 | var writer = new ApprovalTextWriter(publicApi, "cs"); 25 | var approvalNamer = new AssemblyPathNamer(assemblyPath); 26 | ApprovalTests.Approvals.Verify(writer, approvalNamer, ApprovalTests.Approvals.GetReporter()); 27 | } 28 | 29 | private class AssemblyPathNamer : UnitTestFrameworkNamer 30 | { 31 | private readonly string name; 32 | 33 | public AssemblyPathNamer(string assemblyPath) 34 | { 35 | name = Path.GetFileNameWithoutExtension(assemblyPath); 36 | } 37 | 38 | public override string Name 39 | { 40 | get { return name; } 41 | } 42 | } 43 | } 44 | } 45 | #endif -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/RomanianFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Formatters 2 | { 3 | using System; 4 | using System.Globalization; 5 | 6 | internal class RomanianFormatter : DefaultFormatter 7 | { 8 | private const int PrepositionIndicatingDecimals = 2; 9 | private const int MaxNumeralWithNoPreposition = 19; 10 | private const int MinNumeralWithNoPreposition = 1; 11 | private const string UnitPreposition = " de"; 12 | private const string RomanianCultureCode = "ro"; 13 | 14 | private static readonly double Divider = Math.Pow(10, PrepositionIndicatingDecimals); 15 | 16 | private readonly CultureInfo _romanianCulture; 17 | 18 | public RomanianFormatter() 19 | : base(RomanianCultureCode) 20 | { 21 | _romanianCulture = new CultureInfo(RomanianCultureCode); 22 | } 23 | 24 | protected override string Format(string resourceKey, int number) 25 | { 26 | var format = Resources.GetResource(GetResourceKey(resourceKey, number), _romanianCulture); 27 | var preposition = ShouldUsePreposition(number) 28 | ? UnitPreposition 29 | : string.Empty; 30 | 31 | return format.FormatWith(number, preposition); 32 | } 33 | 34 | private static bool ShouldUsePreposition(int number) 35 | { 36 | var prepositionIndicatingNumeral = Math.Abs(number % Divider); 37 | return prepositionIndicatingNumeral < MinNumeralWithNoPreposition 38 | || prepositionIndicatingNumeral > MaxNumeralWithNoPreposition; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Humanizer/Localisation/Formatters/IFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Humanizer.Localisation.Formatters 2 | { 3 | /// 4 | /// Implement this interface if your language has complex rules around dealing with numbers. 5 | /// For example in Romanian "5 days" is "5 zile", while "24 days" is "24 de zile" and 6 | /// in Arabic 2 days is يومين not 2 يوم 7 | /// 8 | public interface IFormatter 9 | { 10 | /// 11 | /// Now 12 | /// 13 | /// Returns Now 14 | string DateHumanize_Now(); 15 | 16 | /// 17 | /// Never 18 | /// 19 | /// Returns Never 20 | string DateHumanize_Never(); 21 | 22 | /// 23 | /// Returns the string representation of the provided DateTime 24 | /// 25 | /// 26 | /// 27 | /// 28 | /// 29 | string DateHumanize(TimeUnit timeUnit, Tense timeUnitTense, int unit); 30 | 31 | /// 32 | /// 0 seconds 33 | /// 34 | /// Returns 0 seconds as the string representation of Zero TimeSpan 35 | string TimeSpanHumanize_Zero(); 36 | 37 | /// 38 | /// Returns the string representation of the provided TimeSpan 39 | /// 40 | /// 41 | /// 42 | /// 43 | string TimeSpanHumanize(TimeUnit timeUnit, int unit); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2017 2 | configuration: Release 3 | branches: 4 | only: 5 | - master 6 | - dev 7 | - /hotfix\/.*/ 8 | 9 | environment: 10 | SignClientSecret: 11 | secure: mn/Un/p3QvEv5TKe2f1NGmppCIMk0jslsTaw8P4+pBQ= 12 | SignClientUser: 13 | secure: q9qZlA/a+Z3wQbRlcjWok/PkfODgpKNECOBCzu2yIGE= 14 | 15 | init: 16 | - git config --global core.autocrlf input 17 | 18 | install: 19 | - cmd: appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/v4.3.0/NuGet.exe 20 | - cmd: nuget install SignClient -Version 0.9.0 -SolutionDir %APPVEYOR_BUILD_FOLDER% -Verbosity quiet -ExcludeVersion 21 | 22 | before_build: 23 | - cmd: msbuild /t:restore src\Humanizer.sln 24 | 25 | build: 26 | verbosity: normal 27 | parallel: true 28 | project: src\Humanizer.sln 29 | 30 | after_build: 31 | - ps: | 32 | $vers = & $env:UserProfile\.nuget\packages\nerdbank.gitversioning\2.0.41\tools\Get-Version.ps1 33 | $nugetVer = $vers.NuGetPackageVersion 34 | ls .\NuSpecs\*.nuspec | %{ nuget pack $_.FullName -version "$nugetVer" -BasePath "src" -NoPackageAnalysis } 35 | - ps: '.\scripts\Sign-Package.ps1' 36 | - ps: 'ls *.nupkg | %{ appveyor PushArtifact $_.Name}' 37 | 38 | test: 39 | assemblies: 40 | - '**\*.Tests.dll' 41 | 42 | deploy: 43 | - provider: NuGet 44 | server: https://www.myget.org/F/humanizer/api/v2/package 45 | on: 46 | branch: master 47 | api_key: 48 | secure: bmqlJK8a5HYiUXOT99HXT1j7JiM5+fpR4kHhxIC30oaaEXbv94f0fKdiKlU1QC/l 49 | artifact: /.*\.nupkg/ 50 | 51 | - provider: NuGet 52 | server: https://www.myget.org/F/humanizer/api/v2/package 53 | on: 54 | branch: dev 55 | api_key: 56 | secure: bmqlJK8a5HYiUXOT99HXT1j7JiM5+fpR4kHhxIC30oaaEXbv94f0fKdiKlU1QC/l 57 | artifact: /.*\.nupkg/ -------------------------------------------------------------------------------- /src/Humanizer.Tests.Shared/Bytes/ComparingTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Humanizer.Bytes; 4 | using Xunit; 5 | 6 | namespace Humanizer.Tests.Bytes 7 | { 8 | public class ComparingTests 9 | { 10 | [Theory] 11 | [InlineData(13, 23, -1)] 12 | [InlineData(23, 23, 0)] 13 | [InlineData(45, 23, 1)] 14 | public void CompareStrongTyped(double value, double valueToCompareWith, int expectedResult) 15 | { 16 | var valueSize = new ByteSize(value); 17 | var otherSize = new ByteSize(valueToCompareWith); 18 | var result = valueSize.CompareTo(otherSize); 19 | 20 | Assert.Equal(expectedResult, result); 21 | } 22 | 23 | [Theory] 24 | [InlineData(13, 23, -1)] 25 | [InlineData(23, 23, 0)] 26 | [InlineData(45, 23, 1)] 27 | public void CompareUntyped(double value, double valueToCompareWith, int expectedResult) 28 | { 29 | var valueSize = new ByteSize(value); 30 | object otherSize = new ByteSize(valueToCompareWith); 31 | var result = valueSize.CompareTo(otherSize); 32 | 33 | Assert.Equal(expectedResult, result); 34 | } 35 | 36 | [Theory] 37 | [InlineData(new[] { "1GB", "3KB", "5MB" }, new[] { "3KB", "5MB", "1GB"})] 38 | [InlineData(new[] { "1MB", "3KB", "5MB" }, new[] { "3KB", "1MB", "5MB"})] 39 | public void SortList(IEnumerable values, IEnumerable expected) 40 | { 41 | var list = values.Select(ByteSize.Parse).ToList(); 42 | list.Sort(); 43 | 44 | Assert.Equal(expected.Select(ByteSize.Parse), list); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/Humanizer/FluentDate/On.Days.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="true" hostSpecific="true" #> 2 | <#@ output extension=".cs" #> 3 | <#@ Assembly Name="System.Core" #> 4 | <#@ Assembly Name="System.Windows.Forms" #> 5 | <#@ assembly name="$(TargetPath)" #> 6 | <#@ import namespace="System" #> 7 | <#@ import namespace="Humanizer" #> 8 | <#@ import namespace="System.IO" #> 9 | <#@ import namespace="System.Diagnostics" #> 10 | <#@ import namespace="System.Linq" #> 11 | <#@ import namespace="System.Collections" #> 12 | <#@ import namespace="System.Collections.Generic" #> 13 | using System; 14 | 15 | namespace Humanizer 16 | { 17 | /// 18 | /// 19 | public partial class On 20 | { 21 | <# 22 | const int leapYear = 2012; 23 | for (int month = 1; month <= 12; month++) 24 | { 25 | var firstDayOfMonth = new DateTime(leapYear, month, 1); 26 | var monthName = firstDayOfMonth.ToString("MMMM");#> 27 | 28 | /// 29 | /// Provides fluent date accessors for <#= monthName #> 30 | /// 31 | public class <#= monthName #> 32 | { 33 | /// 34 | /// The nth day of <#= monthName #> of the current year 35 | /// 36 | public static DateTime The(int dayNumber) 37 | { 38 | return new DateTime(DateTime.Now.Year, <#= month #>, dayNumber); 39 | } 40 | <#for (int day = 1; day <= DateTime.DaysInMonth(leapYear, month); day++) 41 | { 42 | var ordinalDay = day.Ordinalize();#> 43 | 44 | /// 45 | /// The <#= ordinalDay #> day of <#= monthName #> of the current year 46 | /// 47 | public static DateTime The<#= ordinalDay #> 48 | { 49 | get { return new DateTime(DateTime.Now.Year, <#= month #>, <#= day #>); } 50 | } 51 | <#}#> 52 | } 53 | <#}#> 54 | } 55 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | # Custom for Visual Studio 4 | *.cs diff=csharp 5 | *.sln merge=union 6 | *.csproj merge=union 7 | *.vbproj merge=union 8 | *.fsproj merge=union 9 | *.dbproj merge=union 10 | 11 | # Normalise endings to CRLF 12 | *.cs eol=crlf 13 | *.xml eol=crlf 14 | *.xaml eol=crlf 15 | *.xsl eol=crlf 16 | *.xsd eol=crlf 17 | *.cshtml eol=crlf 18 | *.css eol=crlf 19 | *.js eol=crlf 20 | *.txt eol=crlf 21 | *.config eol=crlf 22 | *.sql eol=crlf 23 | *.sln eol=crlf 24 | *.csproj eol=crlf 25 | *.vbproj eol=crlf 26 | *.fsproj eol=crlf 27 | *.dbproj eol=crlf 28 | *.nunit eol=crlf 29 | *.html eol=crlf 30 | *.md eol=crlf 31 | *.proj eol=crlf 32 | *.bat eol=crlf 33 | *.cmd eol=crlf 34 | *.nuspec eol=crlf 35 | *.targets eol=crlf 36 | *.conf eol=crlf 37 | *.manifest eol=crlf 38 | *.ps1 eol=crlf 39 | *.resx eol=crlf 40 | *.asax eol=crlf 41 | *.aspx eol=crlf 42 | *.ncrunchproject eol=crlf 43 | *.ncrunchsolution eol=crlf 44 | *.msbuild eol=crlf 45 | *.template eol=crlf 46 | *.settings eol=crlf 47 | *.java eol=crlf 48 | .gitattributes eol=crlf 49 | .classpath eol=crlf 50 | .project eol=crlf 51 | 52 | # Standard to msysgit 53 | *.doc diff=astextplain 54 | *.DOC diff=astextplain 55 | *.docx diff=astextplain 56 | *.DOCX diff=astextplain 57 | *.dot diff=astextplain 58 | *.DOT diff=astextplain 59 | *.pdf diff=astextplain 60 | *.PDF diff=astextplain 61 | *.rtf diff=astextplain 62 | *.RTF diff=astextplain 63 | -------------------------------------------------------------------------------- /samples/Humanizer.MvcSample/Content/themes/base/jquery.ui.dialog.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Dialog 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Dialog#theming 14 | */ 15 | .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } 16 | .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } 17 | .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } 18 | .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } 19 | .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } 20 | .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } 21 | .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } 22 | .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } 23 | .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } 24 | .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } 25 | .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } 26 | .ui-draggable .ui-dialog-titlebar { cursor: move; } 27 | -------------------------------------------------------------------------------- /src/Humanizer.Tests.Uwp/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | Humanizer.Tests.Uwp 16 | oren 17 | Assets\StoreLogo.png 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | --------------------------------------------------------------------------------