AStarDev.Localization 0.1.0

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

AStarDev.Localization

JSON-file localisation for AStar Development desktop apps.

Usage

  1. Embed one JSON file per culture in your app at Assets/Localization/{culture}.json:

    <EmbeddedResource Include="Assets\Localization\*.json" />
    
    {
      "locale": "en-GB",
      "App.Title": "My app",
      "Greeting": "Hello, {0}"
    }
    
  2. Register the service, passing the assembly that holds the files:

    services.AddLocalizationService(typeof(App).Assembly, new CultureInfo("en-GB"));
    
  3. Read text through ILocalizationService:

    localization.GetLocal("App.Title");
    localization.GetLocal("Greeting", userName);
    

A missing key returns the key itself, so the UI never shows blank text. If the requested culture has no file, the service falls back to the two-letter language, then to en-GB.

Culture switching

SetCultureAsync loads the new culture and raises CultureChanged. Derive view models that display text from LocalizedObservableObject: it raises PropertyChanged for all properties when the culture changes, and holds only a weak subscription, so short-lived view models are not kept alive.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AStarDev.Localization:

Package Downloads
AStarDev.VelopackPublishingAvalonia

Shared Avalonia update-available dialog, view model, and notification services for AStar Development desktop apps, built on AStar.Dev.Velopack.Publishing.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 63 11/18/2026

v0.1.0 feat(localization): extract localisation service into AStarDev.Localization package
       v0.1.0 feat(localization): extract localisation service from AStarDev.OneDriveSyncClient