LiteObservableLanguages 1.0.0-beta1

This is a prerelease version of LiteObservableLanguages.
There is a newer version of this package available.
See the version list below for details.
dotnet add package LiteObservableLanguages --version 1.0.0-beta1
                    
NuGet\Install-Package LiteObservableLanguages -Version 1.0.0-beta1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LiteObservableLanguages" Version="1.0.0-beta1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LiteObservableLanguages" Version="1.0.0-beta1" />
                    
Directory.Packages.props
<PackageReference Include="LiteObservableLanguages" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LiteObservableLanguages --version 1.0.0-beta1
                    
#r "nuget: LiteObservableLanguages, 1.0.0-beta1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LiteObservableLanguages@1.0.0-beta1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LiteObservableLanguages&version=1.0.0-beta1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=LiteObservableLanguages&version=1.0.0-beta1&prerelease
                    
Install as a Cake Tool

NuGet Actions

LiteObservableLanguages

Lightweight I18N and locale support for WPF: culture-aware markup extensions (I18NExtension, I18NBindingExtension), a Locale manager with resource fallback, and source-generated resource keys.

Features

  • Locale: Central manager for current UI culture, ResourceManager, and fallback culture; raises CultureChanged when culture changes; supports fluent configuration (UseResourceManager, UseFallback, UseCulture).
  • I18NExtension ({I18N ...}): Markup extension that resolves resource keys to localized strings in XAML; supports static keys ({x:Static m:LangKeys.Key}) and dynamic keys ({Binding SelectedKey}); supports composite strings via LanguageBinding and nested bindings.
  • I18NBindingExtension ({I18NBinding ...}): Returns a binding that updates automatically when the language changes; ideal for Setter.Value, Trigger setters, and other binding-only scenarios.
  • LocaleExtension: Extension method "Key".Tr() and "Key".Tr(args) for code-behind or view models.
  • Source-generated resource keys: Use [ResourceKeysOf(typeof(Resources))] on a static partial class to generate type-safe key constants (e.g. LangKeys.SomeKey) from your .resx keys.
  • ResourceProvider: Abstract provider for custom resource sources; register with ResourceProvider.Providers for integration with I18NExtension.

Installation

dotnet add package LiteObservableLanguages

Demos (WpfApp)

The WpfApp project demonstrates the following.

1. Language switcher and Locale

ViewModel exposes Culture and AvailableCultures; setting Culture updates I18NExtension.Culture so all I18N bindings refresh.

public CultureInfo Culture
{
    get;
    set
    {
        if (field.EnglishName.Equals(value.EnglishName)) return;
        field = value;
        I18NExtension.Culture = value;
        OnPropertyChanged();
    }
} = new("zh");

2. I18N with static key

<TextBlock Text="{I18N {x:Static m:LangKeys.Select_your_text_to_translate}}" />

3. I18N with dynamic key (binding)

Key can come from a binding (e.g. selected item or user input):

<TextBox Text="{I18N {Binding SelectedKey}}" />
<TextBlock Text="{I18N {Binding InputText}}" />

4. Composite string with LanguageBinding

Use I18N with a template that mixes literal placeholders and LanguageBinding/Binding for dynamic parts:

<TextBlock.Text>
    <I18N Key="{x:Static m:LangKeys.Current_language_is}">
        <LanguageBinding Key="{x:Static m:LangKeys.Language}" />
        <Binding Path="Culture.EnglishName" />
    </I18N>
</TextBlock.Text>

5. I18NBinding in styles and triggers

Use I18NBinding where only a binding is allowed (e.g. Setter.Value):

<Setter Property="Content" Value="{I18NBinding {x:Static m:LangKeys.Off}}" />
<Trigger Property="IsChecked" Value="True">
    <Setter Property="Content" Value="{I18NBinding {x:Static m:LangKeys.On}}" />
</Trigger>

6. Source-generated keys

Define a static partial class and point it at your default resource class; the source generator emits key constants:

[ResourceKeysOf(typeof(Resources))]
public static partial class LangKeys;

Then use LangKeys.SomeKey in XAML or code.

Run WpfApp and switch languages from the list; all text bound with I18N / I18NBinding updates without restart.

Attribution

This project is a fork of Antelcat/I18N — reactive language support for WPF/Avalonia applications when using .resx files.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0-windows7.0 is compatible.  net6.0-windows was computed.  net7.0-windows was computed.  net8.0-windows was computed.  net9.0-windows was computed.  net10.0-windows was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

    • No dependencies.
  • net5.0-windows7.0

    • No dependencies.

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
1.0.0 143 3/17/2026
1.0.0-beta1 125 3/17/2026