ResXLocalization.MessageFormat
2.0.0
Prefix Reserved
dotnet add package ResXLocalization.MessageFormat --version 2.0.0
NuGet\Install-Package ResXLocalization.MessageFormat -Version 2.0.0
<PackageReference Include="ResXLocalization.MessageFormat" Version="2.0.0" />
<PackageVersion Include="ResXLocalization.MessageFormat" Version="2.0.0" />
<PackageReference Include="ResXLocalization.MessageFormat" />
paket add ResXLocalization.MessageFormat --version 2.0.0
#r "nuget: ResXLocalization.MessageFormat, 2.0.0"
#:package ResXLocalization.MessageFormat@2.0.0
#addin nuget:?package=ResXLocalization.MessageFormat&version=2.0.0
#tool nuget:?package=ResXLocalization.MessageFormat&version=2.0.0
ResXLocalization
Type-safe .resx localization for Avalonia and WPF - switch language live, no reload, no restart.
Localizing a XAML app with plain .resx usually means string-typed keys that break silently at
runtime, and a language change that only takes effect after a restart. ResXLocalization fixes both:
you keep the .resx files and editors you already use, and get compile-checked keys and
instant, in-place language switching.
Highlights
- โก Live, no-reload language switching - set one property and every bound string updates in place.
- ๐ Type-safe, compile-checked keys - a source generator turns every neutral
.resxinto strongly-typed keys, with or without a.Designer.cs, so a renamed or deleted resource becomes a compile error, not a runtime surprise. - ๐ฆ Zero configuration - install the package and build; the source generator and MSBuild wiring are included.
- ๐๏ธ First-class multiple
.resxsupport - look up by typed key, scope to one file, or search across all registered files. - ๐ค Enum localization built in - localize enum members by naming convention.
- ๐งฎ Format arguments on the binding - in XAML, give
{l:Localize}and{l:LocalizeEnum}<l:Argument>children with constant or bound values, so enum labels take arguments too; in code, passMessageArguments.FromValues(โฆ)toLocalizer.Current.Get. - ๐ข ICU MessageFormat, opt-in -
pluralandselectmessages such as1 file/5 files, in code and in XAML, with the separate packageResXLocalization.MessageFormat. - ๐ฉบ Lookup-failure diagnostics - a visible, configurable
!key!failure text plus aLookupFailedevent, for a missing translation and for a value that cannot be formatted. - ๐ Language-picker ready -
GetAvailableCultures()discovers the cultures your app actually ships. - ๐ Native AOT & trim clean (Avalonia package) - no reflection over your resources.
Install
dotnet add package ResXLocalization.Avalonia # Avalonia
dotnet add package ResXLocalization.WPF # WPF
| Package | UI framework | Targets | Native AOT |
|---|---|---|---|
ResXLocalization.Avalonia |
Avalonia 12 | net8.0 ยท net10.0 |
โ |
ResXLocalization.WPF |
WPF | net8.0-windows ยท net10.0-windows |
โ (WPF limitation) |
Both share the same UI-agnostic engine (ILocalizer / Localizer.Current, ResourceKey), the same
source generator and the same MSBuild wiring, all of which arrive with the package you install.
ResXLocalization.Core comes along as a dependency, and one copy of it satisfies both UI packages in
an application that uses them together.
For messages whose wording depends on the arguments - plural and select, such as 1 file /
5 files - add the opt-in package ResXLocalization.MessageFormat and call
Localizer.Current.UseMessageFormat() to format every localized text as ICU MessageFormat.
Requirements
- An app targeting .NET 8 or later, built with the .NET 8 SDK or later.
- For Avalonia: Avalonia 12. For WPF: Windows.
.resxfiles. A.Designer.csaccessor is not required: every neutral.resxgets typed keys, with or without one.
In three steps
1. Add a neutral .resx and a satellite file per culture - Resources/AppStrings.resx and
Resources/AppStrings.de.resx, with the same key names.
2. Build. The source generator emits a typed key class per neutral .resx, named
<FileName>Keys - by default in the namespace of the folder the .resx sits in. Only string entries
become keys.
// <auto-generated/> - for AppStrings.resx:
public static partial class AppStringsKeys
{
// The resource manager of AppStrings.resx - the one instance every key of this class uses.
public static ResourceManager ResourceManager { get; } = new("YourApp.Resources.AppStrings", typeof(AppStringsKeys).Assembly);
public static readonly ResourceKey Greeting = new("Greeting", ResourceManager);
public static readonly ResourceKey WindowTitle = new("WindowTitle", ResourceManager);
}
3. Bind, and switch.
<Window xmlns:l="clr-namespace:RentADeveloper.ResXLocalization.Avalonia;assembly=ResXLocalization.Avalonia"
xmlns:res="clr-namespace:YourApp.Resources"
Title="{l:Localize {x:Static res:AppStringsKeys.WindowTitle}}">
<TextBlock Text="{l:Localize {x:Static res:AppStringsKeys.Greeting}}" />
</Window>
Localizer.Current.CurrentCulture = new CultureInfo("de");
Every {l:Localize} binding re-resolves immediately. No reload, no flicker.
For WPF, map xmlns:l to the WPF assembly instead:
xmlns:l="clr-namespace:RentADeveloper.ResXLocalization.WPF;assembly=ResXLocalization.WPF"
When you have to register a resource manager
A typed key carries its own ResourceManager, and a scoped lookup is given one, so neither
needs any registration. Registration exists for the search-all lookups - {l:Localize Greeting},
{l:LocalizeEnum}, and Get("Greeting") - which search the registered managers in registration
order. Register the generated <FileName>Keys.ResourceManager, the instance the typed keys use:
Localizer.Current.RegisterResourceManager(AppStringsKeys.ResourceManager);
Documentation
The full documentation - lookup modes and fallback, registering resource files, enum localization,
dynamic format arguments, ICU MessageFormat, design time and previewers, Native AOT publishing, which
.resx files qualify for generated keys, and migrating to 2.0 - is at
rent-a-developer.github.io/ResXLocalization,
which also hosts the complete API reference.
The project README has the quick start
and two complete runnable sample apps, one per UI framework.
License
Released under the MIT License. ยฉ 2026 David Liebeherr.
Avalonia is a registered trademark of AvaloniaUI Oร, used in the package name with written permission. This project is not affiliated with or endorsed by AvaloniaUI Oร.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MessageFormat (>= 8.0.0)
- ResXLocalization.Core (>= 2.0.0)
-
net8.0
- MessageFormat (>= 8.0.0)
- ResXLocalization.Core (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 99 | 10/20/2026 |