Multi-language content management system, .Net Core CRUD project also include auto-mapper. Thanks to ILocalizedModel, dynamically content can be saved in different languages.
protected virtual void AddLocales<TLocalizedModelLocal>(ILanguageRepository languageService, IList<TLocalizedModelLocal> locales) where TLocalizedModelLocal : ILocalizedModelLocal
{
AddLocales(languageService, locales, null);
}
protected virtual void AddLocales<TLocalizedModelLocal>(ILanguageRepository languageService, IList<TLocalizedModelLocal> locales, Action<TLocalizedModelLocal, int> configure) where TLocalizedModelLocal : ILocalizedModelLocal
{
foreach (var language in languageService.GetAll())
{
var locale = Activator.CreateInstance<TLocalizedModelLocal>();
locale.LanguageId = language.Id;
if (configure != null)
{
configure.Invoke(locale, locale.LanguageId);
}
locales.Add(locale);
}
}
- .Net core 2.2 SDK
- Visual studio 2017 OR VSCode with C# extension
- Microsoft SQL Server (Optional: If MS SQL server required instead of Sqlite during development)
1. Clone the repo:
git clone https://github.com/bernalbant/cms-localization.git
2. Restore packages:
dotnet restore CmsLocalization.sln
3. Add Migration
dotnet ef migrations add InitialMigration
dotnet ef database update
4. Run .Net project:
F5 from either [Visual Studio IDE](https://www.visualstudio.com/) OR [VScode] (https://code.visualstudio.com/):