Rayab.Culture 1.0.0

There is a newer version of this package available.
See the version list below for details.
Install-Package Rayab.Culture -Version 1.0.0
dotnet add package Rayab.Culture --version 1.0.0
<PackageReference Include="Rayab.Culture" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rayab.Culture --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Rayab.Culture, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rayab.Culture as a Cake Addin
#addin nuget:?package=Rayab.Culture&version=1.0.0

// Install Rayab.Culture as a Cake Tool
#tool nuget:?package=Rayab.Culture&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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

  • .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.

Version Downloads Last updated
1.0.1 138 12/17/2020
1.0.0 107 12/1/2020

Build Project - ( Beta )