Switch from Microsoft Localization to Blazorise Localization #1965
-
Hello, I'm trying to switch from Microsoft localization to Blazorise localization, since there should be no need to reload the whole application. I have a simple example:
Programm.cs:
But on load, I get the exception:
What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You cannot inject the default Example 1
Notice Example 2 Example 3 and JSON content {
"culture": "en",
"translations": {
"Next": "Next",
"Previous": "Previous"
}
}
Obviously, if you want your custom page or component then you need to have the same structure in your project, eg |
Beta Was this translation helpful? Give feedback.
You cannot inject the default
ITextLocalizer localizer
. It must have a type definition.Example 1
[Inject] protected ITextLocalizer<Carousel> Localizer { get; set; }
Notice
<Carousel>
. That is the name of the component or class that is localized. And to localize it, it needs to have json files as embedded resources under theResources/Localization/Carousel
.Example 2
Example 3
and JSON content
Obviously, if you want your custom page or component then you need to have the same structure in your project, eg
Resources/Localization/YourComponent
.