Open hishamco opened 5 years ago
Things are change since I wrote my blog post, but let me check or forward your question there ..
According to the Orchard Core docs PO files are found via the following steps:
So you can simply override the ContentRootPoFileLocationProvider
by injecting your CustomContentRootPoFileLocationProvider
into DI as the following:
services.AddSingleton<ILocalizationFileLocationProvider, CustomContentRootPoFileLocationProvider>()
In startup.cs I have like this: services.AddOrchardCms().AddSingleton<ILocalizationFileLocationProvider, MyLIModularPoFileLocationProvider>(); and then I have
public class MyLIModularPoFileLocationProvider : ILocalizationFileLocationProvider
{
public MyLIModularPoFileLocationProvider(IOptions<LocalizationOptions> localizationOptions )
{
_resourcesContainer = localizationOptions.Value.ResourcesPath; // Localization
}
public IEnumerable<IFileInfo> GetLocations(string cultureName)
{
}
}
breakpoint hit in constructor but my breakpoint never hit on GetLocations(string cultureName) method. Do you know what should I do? I also tried with services.Replace(ServiceDescriptor.Singleton<ILocalizationFileLocationProvider, MyLIModularPoFileLocationProvider>());
While the topic go further I think we need to move this to Orchard Core repo for better tracking and involve the community
Hi how can i override ContentRootPoFileLocationProvider and replace using dependency injection. I’m using orchard core as nuget package and tring to override po files location . Is any difference between content root po file location provider and ModularPoFileLocationProvider?