Locale -> Translation

This commit is contained in:
2020-03-06 19:36:36 +00:00
parent 884c834b3d
commit a234b3531d
58 changed files with 540 additions and 569 deletions

View File

@@ -368,12 +368,11 @@ namespace AyaNova
var ct = context.RequestServices.GetService<AyContext>();
//get the user record
//var u = ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { roles = m.Roles, name = m.Name, id = m.Id, localeId = m.LocaleId }).First();
var u = await ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { roles = m.Roles, name = m.Name, id = m.Id, localeId = m.LocaleId }).FirstAsync();
var u = await ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { roles = m.Roles, name = m.Name, id = m.Id, translationId = m.TranslationId }).FirstAsync();
context.Request.HttpContext.Items["AY_ROLES"] = u.roles;
context.Request.HttpContext.Items["AY_USERNAME"] = u.name;
context.Request.HttpContext.Items["AY_USER_ID"] = u.id;
context.Request.HttpContext.Items["AY_LOCALE_ID"] = u.localeId;
context.Request.HttpContext.Items["AY_TRANSLATION_ID"] = u.translationId;
}
await next.Invoke();
});
@@ -443,9 +442,9 @@ namespace AyaNova
//Initialize license
AyaNova.Core.License.InitializeAsync(apiServerState, dbContext, _newLog).Wait();
//Ensure locales are present, not missing any keys and that there is a server default locale that exists
LocaleBiz lb = new LocaleBiz(dbContext, 1, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, AuthorizationRoles.OpsAdminFull);
lb.ValidateLocalesAsync().Wait();
//Ensure translations are present, not missing any keys and that there is a server default translation that exists
TranslationBiz lb = new TranslationBiz(dbContext, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.OpsAdminFull);
lb.ValidateTranslationsAsync().Wait();