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
<PackageReference Include="Krivodeling.Localization.Avalonia" Version="1.0.1" />
<PackageVersion Include="Krivodeling.Localization.Avalonia" Version="1.0.1" />
<PackageReference Include="Krivodeling.Localization.Avalonia" />
paket add Krivodeling.Localization.Avalonia --version 1.0.1
#r "nuget: Krivodeling.Localization.Avalonia, 1.0.1"
#:package Krivodeling.Localization.Avalonia@1.0.1
#addin nuget:?package=Krivodeling.Localization.Avalonia&version=1.0.1
#tool nuget:?package=Krivodeling.Localization.Avalonia&version=1.0.1
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 | Versions 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. |
-
net9.0
- Lang.Avalonia (>= 12.0.5.2)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
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 |