Maxim Fleitling
Maxim Fleitling

Reputation: 562

Alternative for ResxResourceWriter in .NET Core

I need to create Resources(resx-files) in my .NET Core based application. Until now I used to use ResxResourceWriter from System.Windows.Forms for that. Any suggestions how to handle this task in .NET Core?

Beside our existing software, which has it's own localization approach based on some binary file, the new software should benefit from existing expensive translations and even have some translation synchronization of terms, when they added to the binary file.

Of course, you can use XmlSerialization. The question is, whether there is a formal way to create/manage Resx-files in .NET Core.

Upvotes: 11

Views: 4446

Answers (2)

György Kőszeg
György Kőszeg

Reputation: 18013

I happen to have a library with full .resx support. You can find the usual ResXResourceReader, ResXResourceWriter or ResXResourceSet classes. I addressed a lot of security issues of the original WinForms version, while you can enforce full compatibility.

I introduced a lot of new features as well, for example, my ResXResrouceSet can be expanded, and there are several new types such as ResXResourceManager that works as a regular ResourceManager but works directly on .resx files and it supports adding new resources during runtime.

I already offered it for the .NET codebase so maybe it will be migrated at some time. Until then, it is available from NuGet.

Upvotes: 0

farlee2121
farlee2121

Reputation: 3347

Tada! https://www.nuget.org/packages/ResXResourceReader.NetStandard

I extracted ResXReourceWriter and ResXResourceReader from the Winforms github and packaged them for .NetStandard

Upvotes: 12

Related Questions