-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
604bda5
commit 1a1b12f
Showing
6 changed files
with
204 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
using System; | ||
using System.Globalization; | ||
|
||
namespace BrazilModels; | ||
|
||
/// <summary> | ||
/// Lightweight brazilian culture helpers | ||
/// </summary> | ||
public static class BrazilCulture | ||
{ | ||
/// <summary> | ||
/// NumberFormatInfo using ',' for decimal separators and '.' for group separators | ||
/// </summary> | ||
/// {} | ||
public static readonly NumberFormatInfo NumberFormat = | ||
new() | ||
{ | ||
CurrencyDecimalDigits = 2, | ||
CurrencyDecimalSeparator = ",", | ||
CurrencyGroupSeparator = ".", | ||
CurrencyNegativePattern = 9, | ||
CurrencyPositivePattern = 2, | ||
CurrencySymbol = "R$", | ||
NaNSymbol = "NaN", | ||
NegativeInfinitySymbol = "-\u221E", | ||
NegativeSign = "-", | ||
NumberDecimalDigits = 3, | ||
NumberDecimalSeparator = ",", | ||
NumberGroupSeparator = ".", | ||
NumberNegativePattern = 1, | ||
PerMilleSymbol = "\u2030", | ||
PercentDecimalDigits = 3, | ||
PercentDecimalSeparator = ",", | ||
PercentGroupSeparator = ".", | ||
PercentNegativePattern = 1, | ||
PercentPositivePattern = 1, | ||
PercentSymbol = "%", | ||
PositiveInfinitySymbol = "\u221E", | ||
PositiveSign = "\u002B", | ||
NativeDigits = new[] | ||
{ | ||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", | ||
}, | ||
DigitSubstitution = DigitShapes.None, | ||
CurrencyGroupSizes = new[] | ||
{ | ||
3, | ||
}, | ||
NumberGroupSizes = new[] | ||
{ | ||
3, | ||
}, | ||
PercentGroupSizes = new[] | ||
{ | ||
3, | ||
}, | ||
}; | ||
|
||
/// <summary> | ||
/// Format Dates in pt-BR | ||
/// </summary> | ||
public static readonly DateTimeFormatInfo DateTimeFormat = | ||
new() | ||
{ | ||
AMDesignator = "AM", | ||
PMDesignator = "PM", | ||
DateSeparator = "/", | ||
TimeSeparator = ":", | ||
Calendar = new GregorianCalendar(), | ||
CalendarWeekRule = CalendarWeekRule.FirstDay, | ||
FirstDayOfWeek = DayOfWeek.Sunday, | ||
FullDateTimePattern = "dddd, d 'de' MMMM 'de' yyyy HH:mm:ss", | ||
MonthDayPattern = "d 'de' MMMM", | ||
YearMonthPattern = "MMMM 'de' yyyy", | ||
LongDatePattern = "dddd, d 'de' MMMM 'de' yyyy", | ||
LongTimePattern = "HH:mm:ss", | ||
ShortDatePattern = "dd/MM/yyyy", | ||
ShortTimePattern = "HH:mm", | ||
AbbreviatedDayNames = new[] | ||
{ | ||
"dom.", "seg.", "ter.", "qua.", "qui.", "sex.", "sáb.", | ||
}, | ||
AbbreviatedMonthGenitiveNames = new[] | ||
{ | ||
"jan.", | ||
"fev.", | ||
"mar.", | ||
"abr.", | ||
"mai.", | ||
"jun.", | ||
"jul.", | ||
"ago.", | ||
"set.", | ||
"out.", | ||
"nov.", | ||
"dez.", | ||
"", | ||
}, | ||
AbbreviatedMonthNames = new[] | ||
{ | ||
"jan.", | ||
"fev.", | ||
"mar.", | ||
"abr.", | ||
"mai.", | ||
"jun.", | ||
"jul.", | ||
"ago.", | ||
"set.", | ||
"out.", | ||
"nov.", | ||
"dez.", | ||
"", | ||
}, | ||
DayNames = new[] | ||
{ | ||
"domingo", | ||
"segunda-feira", | ||
"terça-feira", | ||
"quarta-feira", | ||
"quinta-feira", | ||
"sexta-feira", | ||
"sábado", | ||
}, | ||
MonthGenitiveNames = new[] | ||
{ | ||
"janeiro", | ||
"fevereiro", | ||
"março", | ||
"abril", | ||
"maio", | ||
"junho", | ||
"julho", | ||
"agosto", | ||
"setembro", | ||
"outubro", | ||
"novembro", | ||
"dezembro", | ||
"", | ||
}, | ||
MonthNames = new[] | ||
{ | ||
"janeiro", | ||
"fevereiro", | ||
"março", | ||
"abril", | ||
"maio", | ||
"junho", | ||
"julho", | ||
"agosto", | ||
"setembro", | ||
"outubro", | ||
"novembro", | ||
"dezembro", | ||
"", | ||
}, | ||
ShortestDayNames = new[] | ||
{ | ||
"D", "S", "T", "Q", "Q", "S", "S", | ||
}, | ||
}; | ||
|
||
/// <summary> | ||
/// Lightweight brazil culture info | ||
/// </summary> | ||
public static readonly CultureInfo CultureInfo = new BrazilCultureInfo(); | ||
|
||
sealed class BrazilCultureInfo : CultureInfo | ||
{ | ||
public BrazilCultureInfo() : base(string.Empty) | ||
{ | ||
this.NumberFormat = BrazilCulture.NumberFormat; | ||
this.DateTimeFormat = BrazilCulture.DateTimeFormat; | ||
} | ||
|
||
public override string Name { get; } = "pt-BR"; | ||
public override string EnglishName { get; } = "Portuguese"; | ||
public override string DisplayName { get; } = "Portuguese (Brazil)"; | ||
public override string NativeName { get; } = "português (Brasil)"; | ||
public override string TwoLetterISOLanguageName { get; } = "pt"; | ||
public override string ThreeLetterISOLanguageName { get; } = "por"; | ||
public override string ThreeLetterWindowsLanguageName { get; } = "PTB"; | ||
public override CultureInfo Parent { get; } = InvariantCulture; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,13 @@ | |
<TargetFramework>net6.0</TargetFramework> | ||
<PackageId>BrazilModels</PackageId> | ||
<Authors>Lucas Teles - [email protected]</Authors> | ||
<Company /> | ||
<Company/> | ||
<Description>CPF/CNPJ models and validators</Description> | ||
<RepositoryType>GitHub</RepositoryType> | ||
<PackageProjectUrl>https://github.com/lucasteles/BrazilModels</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/lucasteles/BrazilModels</RepositoryUrl> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<InvariantGlobalization>true</InvariantGlobalization> | ||
|
||
<IncludeSymbols>true</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
|
@@ -24,7 +25,7 @@ | |
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Include="..\README.md" Pack="true" PackagePath="\" /> | ||
<None Include="..\README.md" Pack="true" PackagePath="\"/> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'"> | ||
|
@@ -38,7 +39,7 @@ | |
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.4.0" /> | ||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
using BrazilModels.Tests.Utils; | ||
using FsCheck; | ||
|
||
namespace BrazilModels.Tests; | ||
|