SQuan.Helpers.Maui.Localization 9.0.19

There is a newer version of this package available.
See the version list below for details.
dotnet add package SQuan.Helpers.Maui.Localization --version 9.0.19
                    
NuGet\Install-Package SQuan.Helpers.Maui.Localization -Version 9.0.19
                    
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="SQuan.Helpers.Maui.Localization" Version="9.0.19" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SQuan.Helpers.Maui.Localization" Version="9.0.19" />
                    
Directory.Packages.props
<PackageReference Include="SQuan.Helpers.Maui.Localization" />
                    
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 SQuan.Helpers.Maui.Localization --version 9.0.19
                    
#r "nuget: SQuan.Helpers.Maui.Localization, 9.0.19"
                    
#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 SQuan.Helpers.Maui.Localization@9.0.19
                    
#: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=SQuan.Helpers.Maui.Localization&version=9.0.19
                    
Install as a Cake Addin
#tool nuget:?package=SQuan.Helpers.Maui.Localization&version=9.0.19
                    
Install as a Cake Tool

SQuan.Helpers.Maui.Localization

The SQuan.Helpers.Maui.Localization provides a localization resource manager, a XAML markup extension and a C# extension method to make localization easier.

Installation

In order to use the toolkit correctly the UseSQuanHelpersMauiLocalization method must be called with your string resource on the MauiAppBuilder class when bootstrapping an application the MauiProgram.cs file. The following example shows how to perform this.

var builder = MauiApp.CreateBuilder();
builder
    .UseMauiApp<App>()
    .UseSQuanHelperMauiLocalization<AppStrings>()

Include the XAML namespace

In order to use the Localize markup extension in XAML, the following xmlns needs to be added into your page or view:

xmlns:i18n="clr-namespace:SQuan.Helpers.Maui.Localization;assembly=SQuan.Helpers.Maui.Localization"

Include the C# namespace

In order to use the Localize extension method in C#, the following using statement needs to be added into your file:

using SQuan.Helpers.Maui.Localization;

Get/Set culture values through the LocalizationManager

The LocalizationManager provides wrappers for InstalledUICulture,CurrentCulture and CurrentUICulture. These wrappers have property change and other event notification to ensure changes in culture are broadcasted to localized strings.

var de_DE = new CultureInfo("de-DE");
LocalizationManager.Current.CurrentCulture = de_DE; // Set date, time, currency to Germany.
LocalizationManager.Current.CurrentUICulture = de_DE; // Set strings to German.

XAML Localize markup extension example

You can use the Localize markup extension in XAML to assign localize string resources to your text properties, e.g.

<Label
    SemanticProperties.HeadingLevel="Level1"
    Style="{StaticResource Headline}"
    Text="{i18n:Localize LBL_HELLO}" />

C# Localize extension method example

You can use the Localize extension method in C# to assign localize string resources to your text properties with parameters, e.g.

[RelayCommand]
void IncrementCounter()
{
    Count++;
    CounterBtn.Localize(Button.TextProperty, "BTN_CLICKED_N_TIMES", Count);
    SemanticScreenReader.Announce(CounterBtn.Text);
}

C# Localize extension method with bindings

You can use the Localize extension method in C# to assign localization string resources to your text properties with bindings.

public MainPage()
{
    BindingContext = this;
    InitializeComponent();
    CounterBtn.Localize(
        Button.TextProperty,
        "BTN_CLICKED_N_TIMES",
        BindingBase.Create(static (LocalizePage m) => m.Count, BindingMode.OneWay, source: this));
}

[RelayCommand]
void IncrementCounter()
{
    Count++;
    SemanticScreenReader.Announce(CounterBtn.Text);
}

XAML Localize markup extension with bindings

You can use the Localize markup extension in XAML to assign localize string resources to your text properties with bindings.

<Button
    x:Name="CounterBtn"
    Command="{Binding IncrementCounterCommand}"
    HorizontalOptions="Start"
    Text="{i18n:Localize BTN_CLICKED_N_TIMES, X0={Binding Count}}" />

Further information

For more information please visit:

Product Compatible and additional computed target framework versions.
.NET net9.0-android35.0 is compatible.  net9.0-ios18.0 is compatible.  net9.0-maccatalyst18.0 is compatible.  net9.0-windows10.0.19041 is compatible.  net10.0-android was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-windows was computed. 
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
9.0.20 148 7/7/2025
9.0.19 134 7/6/2025
1.0.17 138 6/29/2025
1.0.16 138 6/24/2025
1.0.15 107 6/22/2025
1.0.14 67 6/21/2025
1.0.13 140 6/20/2025 1.0.13 is deprecated because it has critical bugs.