Hi,
Can you [Dependency(ReplaceServices = true)] attribute on top of your branding provider like below:
[Dependency(ReplaceServices = true)]
public class BlazorWebiAppBrandingProvider : DefaultBrandingProvider
{
private IStringLocalizer<BlazorWebiApp9087Resource> _localizer;
public BlazorWebiApp9087BrandingProvider(IStringLocalizer<BlazorWebiApp9087Resource> localizer)
{
_localizer = localizer;
}
public override string AppName => _localizer["AppName"];
}
You can also check this document if you are thinking of switching from Lepton to LeptonX.
Hi,
Can you share the logs of your application (log.txt) located under Logs folder?
Hi,
I created a Blazor Web App project from scratch to reproduce your problem.
This application uses ABP packages with version 9.1.0.
I added the code you mentioned as in the picture but I could not reproduce the problem:
Result:
Can you create a project from scratch and try to reproduce this situation to make sure that the problem belongs to your case? If you can reproduce the problem in a project created from scratch, let me know the version of the project you created, etc. and I will try.
Hi,
If it does not fix your problem, please share your solution if it's possible via email (to support@abp.io with ticket number), so we can more quickly fix your problem.
I'm glad to hear that :)
Hi,
You can check this support ticket to disable the multi-tenant filter for Language Texts.
and it works now. Really appreciate the support!
I'm glad your problem is solved.
It might be worth linking that ticket here as this seems to solve the issue requested by the author (at least the part about language texts)
Yes, it is useful to mention it there. Thank you for the information.
Hi,
I think I misunderstood you at first. I understand your question better now. Can you add the following code to your Domain project and try again?
[Dependency(ServiceLifetime.Singleton, ReplaceServices = true)]
[ExposeServices(typeof(DynamicResourceLocalizer), typeof(IDynamicResourceLocalizer))]
public class MyDynamicResourceLocalizer : DynamicResourceLocalizer
{
private readonly ICurrentTenant _currentTenant;
public MyDynamicResourceLocalizer(IServiceScopeFactory serviceScopeFactory, IDistributedCache<LanguageTextCacheItem> cache, ICurrentTenant currentTenant) : base(serviceScopeFactory, cache)
{
_currentTenant = currentTenant;
}
public override LocalizedString GetOrNull(LocalizationResourceBase resource, string cultureName, string name)
{
using (_currentTenant.Change(null))
{
return base.GetOrNull(resource, cultureName, name);
}
}
protected override LanguageTextCacheItem GetCacheItem(LocalizationResourceBase resource, string cultureName)
{
using (_currentTenant.Change(null))
{
return base.GetCacheItem(resource, cultureName);
}
}
protected override Task<LanguageTextCacheItem> GetCacheItemAsync(LocalizationResourceBase resource, string cultureName)
{
using (_currentTenant.Change(null))
{
return base.GetCacheItemAsync(resource, cultureName);
}
}
}
I'm glad to hear that. Feel free to create a new issue if you have further questions.