SqlServer storage implementation for DbLocalizationProvider package
$ dotnet add package LocalizationProvider.Storage.SqlServerIf you find this library useful, cup of coffee would be awesome! You can support further development of the library via Paypal.
I'm pleased to announce that Localization Provider v8.0 is finally out. Again - took a bit longer than expected :)
What's new?
ConfigurationContext now supports config configuration as well (you can change some settings after you have added and configured default settings for localization provider). This is very useful in unit test scenarios when you need to adjust some settings for specific test.More info in this blog post.
LocalizationProvider project is ASP.NET Mvc web application localization provider on steroids.
Giving you the main following features:
Below are code fragments that are essential to get started with a localization provider.
Install required packages:
> dotnet add package LocalizationProvider.AspNetCore
> dotnet add package LocalizationProvider.AdminUI.AspNetCore
> dotnet add package LocalizationProvider.Storage.SqlServer
Following service configuration (usually in Startup.cs) is required to get the localization provider working:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// add your authorization provider (asp.net identity, identity server, whichever..)
services
.AddControllersWithViews()
.AddMvcLocalization();
services.AddRazorPages();
services.AddRouting();
services.AddDbLocalizationProvider(_ =>
{
_.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
...
});
services.AddDbLocalizationProviderAdminUI(_ =>
{
...
});
}
...
}
And following setup of the application is required as a minimum (also usually located in Startup.cs):
public class Startup
{
...
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseDbLocalizationProvider();
app.UseDbLocalizationProviderAdminUI();
app.UseDbLocalizationClientsideProvider(); //assuming that you like also Javascript
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapRazorPages();
endpoints.MapDbLocalizationAdminUI();
endpoints.MapDbLocalizationClientsideProvider();
});
}
}
Also, you can refer to sample app in GitHub for some more hints if needed.
Please read more in this blog post!