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 7 SDK
- Visual studio 2017 or newer OR VSCode with C# extension
- Microsoft SQL Server (Optional: If MS SQL server required instead of Sqlite during development)
- Clone the repo:
git clone https://github.com/bernalbant/cms-localization.git
- Create database:
SqlLocalDB.exe create "CmsLocalizationLocalDB" 15.0 -s
- Update database:
dotnet ef database update
- Run .Net project: F5 from either Visual Studio IDE OR [VScode] (https://code.visualstudio.com/):