|
|
@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Localization;
|
|
|
|
using Microsoft.AspNetCore.Localization;
|
|
|
|
using Microsoft.AspNetCore.RequestLocalization;
|
|
|
|
using Microsoft.AspNetCore.RequestLocalization;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
|
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
using Volo.Abp.Localization;
|
|
|
|
using Volo.Abp.Localization;
|
|
|
|
using Volo.Abp.MultiTenancy;
|
|
|
|
using Volo.Abp.MultiTenancy;
|
|
|
@ -29,19 +28,26 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
|
|
|
|
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
|
|
|
|
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var tenant = await _tenantConfigurationProvider.GetAsync(saveResolveResult: true);
|
|
|
|
var tenant = await _tenantConfigurationProvider.GetAsync(saveResolveResult: true);
|
|
|
|
using (_currentTenant.Change(tenant?.Id, tenant?.Name))
|
|
|
|
if (tenant?.Id != _currentTenant.Id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var requestCulture = await TryGetRequestCultureAsync(context);
|
|
|
|
using (_currentTenant.Change(tenant?.Id, tenant?.Name))
|
|
|
|
if (requestCulture != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CultureInfo.CurrentCulture = requestCulture.Culture;
|
|
|
|
var requestCulture = await TryGetRequestCultureAsync(context);
|
|
|
|
CultureInfo.CurrentUICulture = requestCulture.UICulture;
|
|
|
|
if (requestCulture != null)
|
|
|
|
AbpRequestCultureCookieHelper.SetCultureCookie(
|
|
|
|
{
|
|
|
|
context,
|
|
|
|
CultureInfo.CurrentCulture = requestCulture.Culture;
|
|
|
|
requestCulture
|
|
|
|
CultureInfo.CurrentUICulture = requestCulture.UICulture;
|
|
|
|
);
|
|
|
|
AbpRequestCultureCookieHelper.SetCultureCookie(
|
|
|
|
}
|
|
|
|
context,
|
|
|
|
|
|
|
|
requestCulture
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await next(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
await next(context);
|
|
|
|
await next(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -86,7 +92,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
|
|
|
|
uiCulture = defaultLanguage;
|
|
|
|
uiCulture = defaultLanguage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new RequestCulture(CultureInfo.GetCultureInfo(culture), CultureInfo.GetCultureInfo(uiCulture));
|
|
|
|
return new RequestCulture(culture, uiCulture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|