Plumix.Slang
0.1.0-alpha.13
dotnet add package Plumix.Slang --version 0.1.0-alpha.13
NuGet\Install-Package Plumix.Slang -Version 0.1.0-alpha.13
<PackageReference Include="Plumix.Slang" Version="0.1.0-alpha.13" />
<PackageVersion Include="Plumix.Slang" Version="0.1.0-alpha.13" />
<PackageReference Include="Plumix.Slang" />
paket add Plumix.Slang --version 0.1.0-alpha.13
#r "nuget: Plumix.Slang, 0.1.0-alpha.13"
#:package Plumix.Slang@0.1.0-alpha.13
#addin nuget:?package=Plumix.Slang&version=0.1.0-alpha.13&prerelease
#tool nuget:?package=Plumix.Slang&version=0.1.0-alpha.13&prerelease
Plumix.Slang
Context-based translations for Plumix — a port of Flutter's slang_flutter widget layer on top of Slang.Net.
Slang.Net generates a static translations class, so reading Strings.Instance.Root inside Build gives you the strings of whatever culture was active at that moment — and nothing repaints when the culture changes later. TranslationProvider puts the active translations into the widget tree, so a locale switch rebuilds every widget that read them.
Installation
dotnet add package Plumix.Slang
Core API
| Plumix.Slang | Flutter equivalent | Description |
|---|---|---|
ITranslations<TSelf> |
generated AppLocaleUtils glue |
Bridge to the Slang.Net generated class |
TranslationProvider<T> |
TranslationProvider |
Publishes translations, rebuilds the subtree on switch |
Translations<T>.Of(context) |
Translations.of(context) |
Reads translations and subscribes to switches |
Translations<T>.ReadOf(context) |
— | Reads without subscribing (event handlers) |
LocaleSettings<T> |
LocaleSettings |
SetLocale, SetLocaleRaw, UseDeviceLocale, CurrentCulture |
context.Translations<T>() |
context.t |
Shorthand for Translations<T>.Of(context) |
Usage
1. Implement the bridge on the generated class
Slang.Net emits its API as static members, so the contract uses static abstract members — no reflection, trimming/AOT safe. Only two members need glue; the rest are already generated with matching signatures:
using System.ComponentModel;
using Plumix.Slang;
using Slang;
[Translations(InputFileName = "strings")]
public partial class Strings : ITranslations<Strings>
{
static Strings ITranslations<Strings>.CurrentTranslations => Instance.Root;
static INotifyPropertyChanged ITranslations<Strings>.ChangeSource => Instance;
}
2. Wrap the app
new TranslationProvider<Strings>(
child: new MyApp())
3. Read translations through the context
public override Widget Build(BuildContext context)
{
var t = Translations<Strings>.Of(context); // or context.Translations<Strings>()
return new Text(t.App.Title);
}
Widgets that keep reading Strings.Instance.Root still work — they just will not repaint on a
switch. Anything that should follow the locale has to go through the context.
4. Switch the locale
LocaleSettings<Strings>.SetLocale(new CultureInfo("en-US"));
LocaleSettings<Strings>.SetLocaleRaw("ru");
LocaleSettings<Strings>.UseDeviceLocale();
Unsupported cultures fall back the same way the generated Instance.Root does: exact name, then
any culture with the same language, then BaseCulture. LocaleSettings<T>.Resolve exposes that
mapping, IsSupported checks for an exact match.
By default only CultureInfo.CurrentUICulture moves, so number and date formatting keeps following
the system — pass uiOnly: false to switch CultureInfo.CurrentCulture as well.
Call these from the UI thread: the rebuild they trigger runs synchronously on the caller.
See also
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Plumix (>= 0.1.0-alpha.13)
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-alpha.13 | 78 | 8/1/2026 |