Skip to content

Switch from Microsoft Localization to Blazorise Localization #1965

Answered by stsrki
NeoCoderMatrix86 asked this question in Q&A
Discussion options

You must be logged in to vote

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 the Resources/Localization/Carousel.

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 Resources/Localization/YourComponent.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@NeoCoderMatrix86
Comment options

@stsrki
Comment options

@Jinjinov
Comment options

@stsrki
Comment options

Answer selected by NeoCoderMatrix86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants