Home > Net >  Is IStringLocalizer meant just for ASP.NET?
Is IStringLocalizer meant just for ASP.NET?

Time:04-22

I stumbled across the entire Microsoft Localization Extensions section the other day. IStringLocalizer/ILocalizedString, all that.

I've already got a hand-rolled approach to localization in my current app (.NET 6, WPF, Prism), but I would gladly convert over to this if appropriate; Because it's much easier for a new developer coming on a project to understand something when there are reams of standard MS documentation about it rather than trying to guess what I had in mind.

But virtually every discussion or example of IStringLocalizer that I can find seems to relates to ASP.NET or at least web apps. The docs all seem to assume you're writing ASP.NET.

So are these extensions meant just for ASP.NET and web apps? Is anyone using this approach outside of web apps? And if so can anyone point me to any examples?

-Joe

CodePudding user response:

No, as by docs (2021):

In this article, you will learn how to use the IStringLocalizer and IStringLocalizerFactory implementations. All of the example source code in this article relies on the Microsoft.Extensions.Localization and Microsoft.Extensions.Hosting NuGet packages. For more information on hosting, see .NET Generic Host.

There is no mention of being asp.net specific, although, asp.net applications obviously tend to make use of it as well.

The examples do not use asp.net.

I've used the resx file approach in the early days a lot in WPF applications - although slightly different, I see no reason why it wouldn't work in any regular application.

  • Related