Polyglot.Maui 0.1.0

dotnet add package Polyglot.Maui --version 0.1.0
                    
NuGet\Install-Package Polyglot.Maui -Version 0.1.0
                    
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="Polyglot.Maui" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Polyglot.Maui" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Polyglot.Maui" />
                    
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 Polyglot.Maui --version 0.1.0
                    
#r "nuget: Polyglot.Maui, 0.1.0"
                    
#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 Polyglot.Maui@0.1.0
                    
#: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=Polyglot.Maui&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Polyglot.Maui&version=0.1.0
                    
Install as a Cake Tool

Polyglot.Maui logo

Polyglot.Maui

Runtime localization for .NET MAUI apps, with automatically updating XAML bindings and notifications for view models.

Features

  • Look up strings from your app's .resx resources.
  • Update XAML translations when the culture changes.
  • Notify view models using CommunityToolkit.Mvvm messaging.
  • Persist and restore the user's culture with MAUI Preferences.

Requirements

  • .NET 11 and .NET MAUI 11.
  • Android, iOS, Mac Catalyst, or Windows. The package targets net11.0 and uses MAUI's platform implementations.

Installation and setup

dotnet add package Polyglot.Maui

Create .resx resource files and register their generated resource manager before loading localized XAML:

using Polyglot.Maui;
using YourApp.Resources.Strings;

builder.Services.AddPolyglot(AppResources.ResourceManager);

Restore the culture at startup, before creating pages that use translations:

using System.Globalization;
using Polyglot;

localizationManager.RestorePreviousCulture(CultureInfo.GetCultureInfo("en-US"));

Here localizationManager is an injected ILocalizationManager. Change the language with localizationManager.UpdateUserCulture(CultureInfo.GetCultureInfo("fr-FR")). The chosen culture is saved to MAUI Preferences. Missing resource keys fall back to the key itself.

XAML translations

Declare the namespace and use a resource key:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:polyglot="clr-namespace:Polyglot.Maui;assembly=Polyglot.Maui">
    <Label Text="{polyglot:Translate Welcome}" />
</ContentPage>

The binding updates automatically when the culture changes.

View models

Inject ILocalizedResourcesProvider to read translations and IMessenger to receive CultureChangedMessage. The message's Value contains the new CultureInfo. Raise PropertyChanged for computed properties that depend on translated strings; unlike XAML Translate bindings, they do not update by themselves. Unregister an inactive recipient if it must stop receiving messages, even when using weak registration.

AddPolyglot registers WeakReferenceMessenger.Default if no IMessenger is already registered. Register your own messenger first to use it instead.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.0 0 12/4/2026
0.1.0-preview.1 9 12/3/2026