ResXLocalization
Type-safe .resx localization for Avalonia and
WPF — switch language live, no reload, no
restart.
Start at the repository README for installation and a quick start. These pages are the full documentation.
Guides
| Guide | What it covers |
|---|---|
| Lookup modes and culture fallback | Typed, scoped and search-all lookups, registration order, the fallback chain, missing-translation diagnostics, dependency injection and subscription lifetime |
| Registering resource files | What to register for search-all lookups, where - including the WPF designer and class libraries - dependency injection, resources from other assemblies |
| Localizing enum values | The naming convention, item templates, the converter, custom prefixes and scoping |
| Dynamic format arguments | Get(key, MessageArguments.FromValues(…)), the MessageArguments factory, and <l:Argument> children of {l:Localize} with constant or bound values, optionally named |
| ICU MessageFormat | The opt-in ResXLocalization.MessageFormat package: plural and select through Localizer.Current.UseMessageFormat(), argument mapping, format culture, styles, and migrating resource values to ICU syntax |
| Design time and previewers | DesignTime.Culture for the preview language, the culture a previewer uses without it, search-all lookups and ICU in the WPF designer, and what to expect in Rider's WPF previewer |
| Native AOT and trimming | What to declare, how to publish, and why the repository's own gate runs the native binary |
| Migrating to 2.0 | Each breaking change of 2.0, with what to do |
Reference
| Page | What it covers |
|---|---|
| Generated keys | Which .resx files qualify, what becomes a key, the generator diagnostics, and the Roslyn floor |
API reference
The generated reference covers the runtime assemblies:
| Namespace | Assembly | Contains |
|---|---|---|
RentADeveloper.ResXLocalization |
ResXLocalization.Core |
ILocalizer, Localizer, ResourceKey — the shared engine |
RentADeveloper.ResXLocalization.Avalonia |
ResXLocalization.Avalonia |
The Avalonia markup extensions and converter |
RentADeveloper.ResXLocalization.WPF |
ResXLocalization.WPF |
The WPF markup extensions and converter |
RentADeveloper.ResXLocalization.MessageFormat |
ResXLocalization.MessageFormat |
UseMessageFormat, which installs the ICU MessageFormat formatter |
The packages
| Package | UI framework | Targets | Native AOT |
|---|---|---|---|
ResXLocalization.Avalonia |
Avalonia 12 | net8.0, net10.0 |
Supported |
ResXLocalization.WPF |
WPF | net8.0-windows, net10.0-windows |
Not supported — a WPF limitation |
ResXLocalization.Core |
none | net8.0, net10.0 |
Supported |
ResXLocalization.MessageFormat |
none | net8.0, net10.0 |
Supported |
Install the package for your UI framework; it brings the engine, the source generator and the build
wiring with it. Core arrives as a dependency, and one copy of it satisfies both UI packages in an
application that uses them together. ResXLocalization.MessageFormat is optional: add it next to the UI
package to format with ICU MessageFormat, see ICU MessageFormat.