Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 13 days ago
JSON representation
Localization.SqlLocalizer & ASP.NET Core MVC Localization Examples
- Host: GitHub
- URL: https://github.com/damienbod/aspnetcorelocalization
- Owner: damienbod
- License: mit
- Created: 2015-10-16T19:19:59.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2023-05-10T10:53:21.000Z (over 1 year ago)
- Last Synced: 2024-10-25T11:51:08.127Z (19 days ago)
- Topics: asp-net-core, aspnetcore, ef-core, globalization, localization, mvc, sql
- Language: C#
- Homepage: http://damienbod.com/2015/10/21/asp-net-5-mvc-6-localization/
- Size: 767 KB
- Stars: 251
- Watchers: 21
- Forks: 102
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
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/
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 localizationModelContextdotnet ef database update Localization --context localizationModelContext
```========================
# ASP.NET Core MVC Localization Example