Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/damienbod/AspNetCoreLocalization

Localization.SqlLocalizer & ASP.NET Core MVC Localization Examples
https://github.com/damienbod/AspNetCoreLocalization

asp-net-core aspnetcore ef-core globalization localization mvc sql

Last synced: 1 day ago
JSON representation

Localization.SqlLocalizer & ASP.NET Core MVC Localization Examples

Awesome Lists containing this project

README

        

| | Build | Localization.SqlLocalizer |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| .net core | [![Build status](https://ci.appveyor.com/api/projects/status/gyychgc7l5g4g5lb?svg=true)](https://ci.appveyor.com/project/damienbod/aspnet5localization) | [![NuGet Status](http://img.shields.io/nuget/v/Localization.SqlLocalizer.svg?style=flat-square)](https://www.nuget.org/packages/Localization.SqlLocalizer/) |

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

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

NuGet | Issues | Code

Basic Usage ASP.NET Core

Add the NuGet package to the project.csproj file

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

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

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

services.AddDbContext(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