Skip to content

ciker/AspNet5Localization

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Localization.SqlLocalizer NuGet Status

Documentation: https://damienbod.com/2016/05/26/released-sql-localization-nuget-package-for-asp-net-core-dotnet/

NuGet | Issues | Code

Release History

Version 1.0.1

  • Added Unique constraint for key, culture
  • Fixed type full name cache bug

Version 1.0.0

  • Initial release
  • Runtime localization updates
  • Cache support, reset cache
  • ASP.NET DI support
  • Supports any Entity Framework Core database

Basic Usage ASP.NET Core

Add the NuGet package to the project.json file

"dependencies": {
        "Localization.SqlLocalizer": "1.0.0.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("Angular2LocalizationAspNetCore")
		)
	);

	// 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 1.0 MVC Localization Example

Packages

No packages published

Languages

  • C# 100.0%