Rayab.Culture
1.0.1
dotnet add package Rayab.Culture --version 1.0.1
NuGet\Install-Package Rayab.Culture -Version 1.0.1
<PackageReference Include="Rayab.Culture" Version="1.0.1" />
paket add Rayab.Culture --version 1.0.1
#r "nuget: Rayab.Culture, 1.0.1"
// Install Rayab.Culture as a Cake Addin #addin nuget:?package=Rayab.Culture&version=1.0.1 // Install Rayab.Culture as a Cake Tool #tool nuget:?package=Rayab.Culture&version=1.0.1
Welcome to Markdown Monster
Dot Net Core Calendar Culture.
This library is for change Date and Time culture in your ASP.Net Core projects. For example, if you have a multi-language project, You must change your culture at each request to display to users. This is very simple, Let me show you how it works.
How to work:
- Import this library in your project.
- Set Culture in your startup.cs inside ConfigureServices.
- Enjoy it.
Setup in startup.cs inside ConfigureServices per application:
public void ConfigureServices(IServiceCollection services)
{
CultureInfo.DefaultThreadCurrentCulture =
CultureInfo.DefaultThreadCurrentUICulture =
RCulture.GetCulture(ELanguageCountryCode.en_US);
}
Setup in action per request:
public IActionResult Index()
{
CultureInfo.DefaultThreadCurrentCulture =
CultureInfo.DefaultThreadCurrentUICulture =
RCulture.GetCulture(ELanguageCountryCode.en_US);
return View();
}
Customize:
To customize the library, You have many options.
- Option 1: Create your custom Calendar and use like this:
// arg 2 is optional, we supported GregorianCalendar, PersianCalendar, Chinese Calendar and UmAlQuraCalendar by default if you use ELanguageCountryCode alone.
var cultureInfo = RCulture.GetCulture(ELanguageCountryCode.en_US, new CustomCalendar());
- Option 2: Change your country by ELanguageCountryCode, this is an enum class.
- Option 3: Define your CultureInformation and use in constructor like this:
// Do not remember, MonthNames and AbbreviatedMonthNames need 13 record ( not 12 record )
// Empty record ( "" ) is for that.
var customCultureInformation = new RCultureInformation()
{
LanguageCountryCode = ELanguageCountryCode.en_US,
AbbreviatedDayNames = new[] {"Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"},
DayNames = new[] {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
AbbreviatedMonthNames = new[] {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""},
MonthNames = new[] {"January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""},
AMDesignator = "AM",
PMDesignator = "PM",
ShortDateFormat = "yyyy/MM/dd",
LongDateFormat = "dddd, dd MMMM,yyyy",
FirstDayOfWeek = DayOfWeek.Sunday,
NumberDecimalSeparator = ".",
Calendar = new GregorianCalendar()
}
Note: We supported these 14 countries: English - United State, English - Canada, English - Australia, Chinese, Russian, French, Spanish, Italian, German, Turkey, Iran, Afganistan, Iraq, Arabia - Saudia
Note: If you want help to Develop this library for support more countries, Call me with my Gmail.
Rayab.Developer@Gmail.Com
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fixe some problem.