I don't really like the idea of injecting localizer, what's wrong with the classic approach of having a class with static properties generated? It's much easier to use than injecting IStringLocalizer everywhere I want to localize.
I understand that using this interface allows us to swap the implementation to localize using something other than resources but if we only want to use resources, is it worth the trouble?
Short answer is, ease of use and speedup of development time.
A shared class with static properties requires to pre-define all localized strings in advance.
But in case of using IStringLocalizer you don't have to pre-define the localized strings, you just type plain texts during development, and later on you can define the localized versions in the resource files.
additionally, it will much easier to manage localization with IStringLocalizer if you have a team working on the same project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With