GitXplorerGitXplorer
d

AspNetCoreLocalization

public
252 stars
102 forks
27 issues

Commits

List of commits on branch main.
Verified
20f304d477267dddb04052ac9539e36033515740

Merge pull request #93 from nehio/main

ddamienbod committed 2 years ago
Verified
26729c3ed82ca24604109fd6d429770b63032df1

Update Localization.SqlLocalizer.csproj

nnehio committed 2 years ago
Verified
3e88aa6701cde503e1595d529e27770fb0e98f50

Update Changelog.md

ddamienbod committed 3 years ago
Verified
bdaafbd0417ec31930d1df17b6871d3f0fe75132

Merge pull request #88 from suntereo/main

ddamienbod committed 3 years ago
Unverified
336244703d44c9356092682bf2f9d97a7e5781f6

This change enhances fallback behavior so that if there is no "en-US" record in the table but there is "en", it will return "en" instead of not found. This change could further be enhanced by adding a setting to turn on/off.

committed 3 years ago
Unverified
c1f5edf0c11dafaa7cdc18222bcce980def46da0

I would like to make it so that matching LocalizationCulture is case insensitive. If a person managing localization data uses “en-us” instead of “en-US” for a record, it will not be found because the search today is case sensitive. This change makes it case insensitive.

committed 3 years ago

README

The README file for this repository.
Build Localization.SqlLocalizer
.net core Build status NuGet Status

========================

Documentation: http://localizationsqllocalizer.readthedocs.io/en/latest/

NuGet | Issues | Code

Basic Usage ASP.NET Core

Add the NuGet package to the project.csproj file

"dependencies": {
        "Localization.SqlLocalizer": "3.1.0",

Add the DbContext and use the AddSqlLocalization extension method to add the SQL Localization package.

public void ConfigureServices(IServiceCollection services)
{
    // init database for localization
    var sqlConnectionString = Configuration["DbStringLocalizer:ConnectionString"];

    services.AddDbContext<LocalizationModelContext>(options =>
        options.UseSqlite(
            sqlConnectionString,
            b => b.MigrationsAssembly("ImportExportLocalization")
        ),
        ServiceLifetime.Singleton,
        ServiceLifetime.Singleton
    );

    // Requires that LocalizationModelContext is defined
    services.AddSqlLocalization(options => options.UseTypeFullNames = true);

Create your database

dotnet ef migrations add Localization --context localizationModelContext

dotnet ef database update Localization --context localizationModelContext

========================

ASP.NET Core MVC Localization Example