OneCore.Net.AVL.Localization
0.1.0
dotnet add package OneCore.Net.AVL.Localization --version 0.1.0
NuGet\Install-Package OneCore.Net.AVL.Localization -Version 0.1.0
<PackageReference Include="OneCore.Net.AVL.Localization" Version="0.1.0" />
<PackageVersion Include="OneCore.Net.AVL.Localization" Version="0.1.0" />
<PackageReference Include="OneCore.Net.AVL.Localization" />
paket add OneCore.Net.AVL.Localization --version 0.1.0
#r "nuget: OneCore.Net.AVL.Localization, 0.1.0"
#:package OneCore.Net.AVL.Localization@0.1.0
#addin nuget:?package=OneCore.Net.AVL.Localization&version=0.1.0
#tool nuget:?package=OneCore.Net.AVL.Localization&version=0.1.0
![]()
OneCore.Net.AVL.Localization Library
Overview
OneCore.Net.AVL.Localization provides way to localize Avalonia UI applications using application resources.
It additionally supports language switch at runtime.
Features
- Localizer Gets known about the translation resources and provides the switch.
- Translator Allow loading translations including handling of named placeholders.
Getting Started
Installation:
- Install the OneCore.Net.AVL.Localization library via NuGet Package Manager:
dotnet add package OneCore.Net.AVL.Localization(Optionally) Generate translation keys
public class TransKeys { public static readonly object MainViewTitle = new(); public static readonly object DemoText = new(); }Generate the translation files
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:resources="clr-namespace:OneBoard.Shared.Resources" xmlns:system="clr-namespace:System;assembly=System.Runtime"> <system:String x:Key="{x:Static resources:TransKeys.MainViewTitle}">My App</system:String> <system:String x:Key="{x:Static resources:TransKeys.DemoText}">Hello {userName}</system:String> </ResourceDictionary>Register translations
Localizer.RegisterTranslations("en", "avares://MyApp.Resources/Translations.en.axaml"); Localizer.RegisterTranslations("de", "avares://MyApp.Resources/Translations.de.axaml");Swap language and culture
Localizer.SwapCulture("en"); Localizer.SwapLanguage("en");Load translations in axaml
Title="{DynamicResource {x:Static resources:TransKeys.MainViewTitle}}"Load translations by code
var translation = Translator.GetString(TransKeys.MainViewTitle);Load translations by code with handle of named placeholders
var translation = Translator.GetString(TransKeys.MainViewTitle, "{userName}", _userName);
Links
License
Copyright (c) David Wendland. All rights reserved. Licensed under the MIT License. See LICENSE file in the project root for full license information.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Avalonia (>= 11.3.6)
- Avalonia.Fonts.Inter (>= 11.3.6)
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 |
|---|