Localization in code behind

Hi everyone,
in my application I manage 2 different languages (Italian, English) I have already set the localization and on the frontend everything works correctly.
How do I translate static strings present in the code (such as the title of the dialogservice, or the values of a dropdown?)

Hi @Anyverse,

You can use the injected property of type ILocalization to get arbitrary localized message in code.

1 Like

Sorry Korchev,
I did the inject as you suggested but I don't know how to then call the property in the code.
Could you write me a simple code example?

Initialize that property inside OnInitializedAsync. You can't use instance properties to initialize other properties - you would see the error says it needs a constant expression.