Locate PO files from an absolute path for Localization #16265
Answered
by
VenkatCharyBhairoju
VenkatCharyBhairoju
asked this question in
Q&A
-
To Locate PO files from an absolute path for localization, I have tried implementing OrchardCore.Localization.PortableObject.ILocalizationFileLocationProvider interface and registered as a service. But it is not working for me and I don't find any solutions/samples online. Could you please suggest me a sample code to achieve this. I am using .net8.0 |
Beta Was this translation helpful? Give feedback.
Answered by
VenkatCharyBhairoju
Jun 13, 2024
Replies: 1 comment 9 replies
-
Please show us your registration, also have a look to PO files locations https://docs.orchardcore.net/en/latest/reference/modules/Localize/#po-files-locations |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @hishamco It started working when I moved the AddPortableObjectLocalization() registration above the custom file provider.
builder.Services.AddPortableObjectLocalization();
// Register the custom provider with the absolute path to PO files
var absolutePath = Path.Combine("C:", "LocalizationFiles");
builder.Services.AddSingleton(serviceProvider =>
{
var logger = serviceProvider.GetRequiredService();
return new CustomAbsolutePathPoFileLocationProvider(absolutePath, logger);
});
Thank you so much for your time. I am marking it as Answered