LocalizationProvider.AdminUI.AspNetCore
8.2.0
See the version list below for details.
dotnet add package LocalizationProvider.AdminUI.AspNetCore --version 8.2.0
NuGet\Install-Package LocalizationProvider.AdminUI.AspNetCore -Version 8.2.0
<PackageReference Include="LocalizationProvider.AdminUI.AspNetCore" Version="8.2.0" />
paket add LocalizationProvider.AdminUI.AspNetCore --version 8.2.0
#r "nuget: LocalizationProvider.AdminUI.AspNetCore, 8.2.0"
// Install LocalizationProvider.AdminUI.AspNetCore as a Cake Addin #addin nuget:?package=LocalizationProvider.AdminUI.AspNetCore&version=8.2.0 // Install LocalizationProvider.AdminUI.AspNetCore as a Cake Tool #tool nuget:?package=LocalizationProvider.AdminUI.AspNetCore&version=8.2.0
Supporting LocalizationProvider
If you find this library useful, cup of coffee would be awesome! You can support further development of the library via Paypal.
Localization Provider v8.0 IS OUT!
Read more about v8.0 release here.
What is the LocalizationProvider project?
LocalizationProvider project is ASP.NET Core web application localization provider on steroids.
Giving you the main following features:
- Database-driven localization provider for .Net applications
- Easy resource registrations via code
- Supports hierarchical resources (with the help of child classes)
Source Code Repos
The whole package of libraries is split into multiple git repos (with submodule linkage in between). Below is list of all related repositories:
Project Structure
Database localization provider is split into main abstraction projects and .NET Core support project (this).
Getting Started
Bare Minimum to Start With
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.MapRazorPages();
endpoints.MapDbLocalizationAdminUI();
endpoints.MapDbLocalizationClientsideProvider();
});
}
}
You can grab some snippets from this sample Startup.cs
file:
using System.Collections.Generic;
using System.Globalization;
using DbLocalizationProvider.AdminUI.AspNetCore;
using DbLocalizationProvider.AdminUI.AspNetCore.Routing;
using DbLocalizationProvider.AspNetCore;
using DbLocalizationProvider.AspNetCore.ClientsideProvider.Routing;
using DbLocalizationProvider.Core.AspNetSample.Data;
using DbLocalizationProvider.Core.AspNetSample.Resources;
using DbLocalizationProvider.Storage.SqlServer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace SampleApp
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(
options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services
.AddDefaultIdentity<IdentityUser>()
.AddRoles<IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>();
services
.AddControllersWithViews()
.AddMvcLocalization();
services.AddRazorPages();
services.AddRouting();
var supportedCultures = new List<CultureInfo> { new CultureInfo("sv"), new CultureInfo("no"), new CultureInfo("en") };
services.Configure<RequestLocalizationOptions>(opts =>
{
opts.DefaultRequestCulture = new RequestCulture("en");
opts.SupportedCultures = supportedCultures;
opts.SupportedUICultures = supportedCultures;
});
services.AddDbLocalizationProvider(_ =>
{
_.EnableInvariantCultureFallback = true;
_.ScanAllAssemblies = true;
_.FallbackCultures.Try(supportedCultures);
_.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
});
services.AddDbLocalizationProviderAdminUI(_ =>
{
_.RootUrl = "/localization-admin";
_.ShowInvariantCulture = true;
_.ShowHiddenResources = false;
_.DefaultView = ResourceListView.Tree;
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
var options = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
app.UseRequestLocalization(options.Value);
app.UseRouting();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAuthentication();
app.UseAuthorization();
app.UseDbLocalizationProvider();
app.UseDbLocalizationProviderAdminUI();
app.UseDbLocalizationClientsideProvider();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
endpoints.MapRazorPages();
endpoints.MapDbLocalizationAdminUI();
endpoints.MapDbLocalizationClientsideProvider();
});
}
}
}
Also, you can refer to sample app in GitHub for some more hints if needed.
More Detailed Help
- Getting Started
- Getting Started with AdminUI
- Localizing App Content
- Localizing View Model (with DataAnnotations attributes)
- Localizing Client-side
GitHub Source Code Structure
.NET Core support project has its own repo while main abstraction projects are included as submodules here.
How to Contribute
It's super cool if you read this section and are interesed how to help the library. Forking and playing around sample application is the fastest way to understand how localization provider is working and how to get started.
Forking and cloning repo is first step you do. Keep in mind that provider is split into couple repositories to keep thigns separated. Additional repos are pulled in as submodules. If you Git client does not support automatic checkout of the submodules, just execute this command at the root of the checkout directory:
git clone --recurse-submodules git://github.com/...
Building AdminUI.AspNetCore Project
You will need to run npm install
at root of the project to get some of the dependencies downloaded to get started.
Some files from these packages are embedded as part of the AdminUI - therefore compilation will fail without those files.
Other Versions
v7.0 is OUT
Please read more in this blog post!
What's new in v6?
Please refer to this post to read more about new features in v6.
More Info
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- LocalizationProvider (>= 8.2.0)
- LocalizationProvider.Abstractions (>= 8.2.0)
- LocalizationProvider.AdminUI.Models (>= 8.2.0)
- LocalizationProvider.AspNetCore (>= 8.2.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on LocalizationProvider.AdminUI.AspNetCore:
Package | Downloads |
---|---|
LocalizationProvider.AdminUI.AspNetCore.Csv
Database driven localization provider. Csv import/export package for Admin UI for Asp.Net Core apps. |
|
LocalizationProvider.AdminUI.AspNetCore.Xliff
Database driven localization provider. Xliff import/export package for Admin UI for Asp.Net Core apps. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.2.2 | 43 | 11/15/2024 |
8.2.0 | 3,729 | 9/23/2024 |
8.1.5 | 7,110 | 8/27/2024 |
8.1.4 | 5,337 | 8/15/2024 |
8.1.3 | 998 | 8/13/2024 |
8.1.2 | 986 | 8/7/2024 |
8.1.1 | 278 | 8/4/2024 |
8.1.0 | 6,867 | 6/5/2024 |
8.0.3 | 8,187 | 5/5/2024 |
8.0.2 | 6,494 | 3/28/2024 |
8.0.1 | 2,945 | 3/5/2024 |
8.0.0 | 3,279 | 2/17/2024 |
7.5.2 | 44,379 | 12/23/2023 |
7.5.1 | 110,686 | 1/1/2023 |
7.5.0 | 19,795 | 11/12/2022 |
7.4.0 | 8,642 | 9/29/2022 |
7.3.1 | 17,573 | 8/30/2022 |
7.3.0 | 12,449 | 6/9/2022 |
7.2.1 | 5,004 | 3/17/2022 |
7.2.0 | 14,651 | 3/3/2022 |
7.1.0 | 1,482 | 2/10/2022 |
7.0.0 | 18,666 | 1/23/2022 |
7.0.0-pre-0015 | 505 | 1/19/2022 |
7.0.0-pre-0014 | 462 | 1/16/2022 |
7.0.0-pre-0013 | 716 | 12/27/2021 |
7.0.0-pre-0012 | 599 | 11/30/2021 |
7.0.0-pre-0011 | 1,920 | 11/26/2021 |
7.0.0-pre-0010 | 5,706 | 11/24/2021 |
7.0.0-pre-0009 | 5,632 | 11/24/2021 |
7.0.0-pre-0008 | 4,794 | 11/24/2021 |
7.0.0-pre-0007 | 6,607 | 11/23/2021 |
7.0.0-pre-0006 | 1,540 | 10/31/2021 |
7.0.0-pre-0005 | 1,133 | 10/17/2021 |
7.0.0-pre-0004 | 680 | 10/4/2021 |
7.0.0-pre-0003 | 773 | 9/12/2021 |
7.0.0-pre-0002 | 717 | 8/30/2021 |
7.0.0-pre-0001 | 610 | 7/25/2021 |
6.5.0 | 3,796 | 5/7/2021 |
6.4.0 | 1,588 | 12/22/2020 |
6.3.0 | 1,281 | 10/27/2020 |
6.2.2 | 4,120 | 9/9/2020 |
6.2.1 | 739 | 9/9/2020 |
6.2.0 | 1,646 | 7/9/2020 |
6.1.1 | 924 | 6/19/2020 |
6.1.0 | 781 | 6/9/2020 |
6.0.3 | 1,339 | 3/18/2020 |
6.0.2 | 749 | 3/17/2020 |
6.0.1 | 814 | 3/16/2020 |
6.0.0 | 858 | 2/21/2020 |
5.7.1 | 3,631 | 7/14/2019 |
5.7.0 | 965 | 6/30/2019 |
5.6.0 | 1,407 | 5/7/2019 |
5.5.1 | 1,538 | 4/19/2019 |
5.5.0 | 1,004 | 4/8/2019 |
5.4.0 | 1,051 | 2/28/2019 |
5.3.0 | 1,278 | 2/10/2019 |
5.1.0 | 1,272 | 1/13/2019 |
5.0.0 | 2,363 | 10/18/2018 |
4.2.2 | 2,634 | 4/28/2018 |