You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without this reference, there is no HtmlLocalizer and also no data annotations localization - these are not supported in Blazor WASM.
Furthermore, the setup in LocalizationServiceCollectionExtensions.AddPortableObjectLocalization doesn't work for Blazor WASM since - as far as I found - it doesn't support local files. So using ContentRootPoFileLocationProvider makes no sense.
Also, for
Describe the solution you'd like
Split the assemblies/ nuget packages so that
OrchardCore.Localization.Core
provides localization via PortableObjectStringLocalizer
possibly features something like LocalizationServiceCollectionExtensions.AddPortableObjectLocalization, but doesn't register ITranslationProvider because how this works depends on where you use it in
OrchardCore.Localization.Mvc
provides localization via PortableObjectHtmlLocalizer and for data annotations
depends on OrchardCore.Localization.Core (to provide PortableObjectStringLocalizer ).
provides LocalizationServiceCollectionExtensions (move them here).
Describe alternatives you've considered
Varying on what I've wrote above, the aspect of where is the PO file retrieved from could made pluggable, and a choice of:
from file
... option of root dir location
from web address
could be offered.
Notes
As an experiment, I've removed the ``and all types that fail to compile then. I've also had to plug in a customizedITranslationProvider` because so as to load the PO files from the web server (via `HttpClient`) instead of from a local file (I don't think these are availabel in Blazor WASM - at least i couldn't find a way to include these...).
This way I got it working.
The text was updated successfully, but these errors were encountered:
You can create a Pull Request with your suggested changes that will be easier to review. Then, also, what @hishamco said. This was not designed with Blazor in mind as it happened after.
Is your feature request related to a problem? Please describe.
After installing
OrchardCore.Localization.Core
into a .net 8 Blazor WASM project I get the following error:This is due to the
<FrameworkReference Include="Microsoft.AspNetCore.App" />
in the csproj.Without this reference, there is no
HtmlLocalizer
and also no data annotations localization - these are not supported in Blazor WASM.Furthermore, the setup in
LocalizationServiceCollectionExtensions.AddPortableObjectLocalization
doesn't work for Blazor WASM since - as far as I found - it doesn't support local files. So usingContentRootPoFileLocationProvider
makes no sense.Also, for
Describe the solution you'd like
Split the assemblies/ nuget packages so that
OrchardCore.Localization.Core
PortableObjectStringLocalizer
LocalizationServiceCollectionExtensions.AddPortableObjectLocalization
, but doesn't registerITranslationProvider
because how this works depends on where you use it inOrchardCore.Localization.Mvc
PortableObjectHtmlLocalizer
and for data annotationsOrchardCore.Localization.Core
(to providePortableObjectStringLocalizer
).LocalizationServiceCollectionExtensions
(move them here).Describe alternatives you've considered
Varying on what I've wrote above, the aspect of where is the PO file retrieved from could made pluggable, and a choice of:
could be offered.
Notes
As an experiment, I've removed the ``
and all types that fail to compile then. I've also had to plug in a customized
ITranslationProvider` because so as to load the PO files from the web server (via `HttpClient`) instead of from a local file (I don't think these are availabel in Blazor WASM - at least i couldn't find a way to include these...).This way I got it working.
The text was updated successfully, but these errors were encountered: