Krivodeling.Localization.Avalonia 1.0.1

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

English | Русский

Localization for Avalonia applications with support for custom translations.

Build and test

dotnet test Krivodeling.Localization.Avalonia.sln -c Release
dotnet pack src/Krivodeling.Localization.Avalonia/Krivodeling.Localization.Avalonia.csproj -c Release

Packages are saved to artifacts/packages. Packing does not publish them. To restore an application's dependencies using a local unpublished package, use -p:RestoreAdditionalProjectSources="<repository>/artifacts/packages".

Application integration

Add Resources/Localizations/English.json and Resources/Localizations/Русский.json as embedded resources to each application or component providing translations. Different components must use different top-level sections; the English and Russian dictionaries must contain the same keys.

using Krivodeling.Localization.Avalonia;

BuiltInLocalizationCatalog catalog = BuiltInLocalizationCatalog.FromAssemblies(
    typeof(App).Assembly,
    typeof(EmbeddedComponent).Assembly);
using LocalizationService localization = new(
    new DirectoryLocalizationFileStore(localizationDirectory),
    catalog,
    loggerFactory.CreateLogger<LocalizationService>());
await localization.RefreshAvailableLocalizationsAsync(ct);
localization.SelectSavedOrEnglishFallback(savedLanguageId);

Keep the service alive for the application lifetime. The application selects and saves the language, while embedded components use the same Lang.Avalonia manager. LocalizationBinding.Bind creates bindings that update when the language changes for controls created in code. LocalizationFileStore allows you to connect the application's existing trusted file storage.

Translation format

{
  "schemaVersion": 1,
  "culture": "de-DE",
  "strings": {
    "Example": {
      "Copy": "Kopieren"
    }
  }
}

The JSON filename, without its extension, identifies the translation variant. _template.json contains the combined English dictionary and is updated atomically when its contents change. Users can copy it under a new filename and translate the entries. Custom files are limited to 8 MiB and a nesting depth of 64. Invalid files and unknown keys are skipped and logged. Missing translations fall back to English; requesting an unsupported key returns the key itself.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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 Krivodeling.Localization.Avalonia:

Package Downloads
Pica.Viewer

Embeddable Pica image viewer for Avalonia.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 57 10/4/2026