radj307.Localization
                             
                            
                                0.3.3
                            
                        
                    dotnet add package radj307.Localization --version 0.3.3
NuGet\Install-Package radj307.Localization -Version 0.3.3
<PackageReference Include="radj307.Localization" Version="0.3.3" />
<PackageVersion Include="radj307.Localization" Version="0.3.3" />
<PackageReference Include="radj307.Localization" />
paket add radj307.Localization --version 0.3.3
#r "nuget: radj307.Localization, 0.3.3"
#:package radj307.Localization@0.3.3
#addin nuget:?package=radj307.Localization&version=0.3.3
#tool nuget:?package=radj307.Localization&version=0.3.3
radj307.Localization
Easy to use localization libraries for C# & WPF.
Loosely based on CodingSeb.Localization.
| Nuget | Version | 
|---|---|
| radj307.Localization | |
| radj307.Localization.WPF | |
| radj307.Localization.Json | |
| radj307.Localization.Yaml | |
| radj307.Localization.Xml | 
Packages
The library's functionality is divided between packages, allowing you to only install what you need.
- radj307.Localization
 Contains the core library, theLocclass, and the translation functionality.
- radj307.Localization.WPF
 Contains theTrmarkup extension and some binding converters.
 The provided markup extension allows you to swap languages at runtime without any additional code.
- radj307.Localization.Json
 Contains the default serializer/deserializer for JSON translation config files.
- radj307.Localization.Yaml
 Contains the default serializer/deserializer for YAML translation config files.
- radj307.Localization.Xml
 Contains the default serializer/deserializer for XML translation config files.
Basic Usage
C#
using Localization;
Loc.Instance.CurrentLanguageName = "English";
Loc.Instance.Translate("MainWindow.Text"); //< "Hello World!"
Loc.Instance.CurrentLanguageName = "French";
Loc.Instance.Translate("MainWindow.Text"); //< "Salut tout le monde!"
// Loc.Tr is equivalent to Loc.Instance.Translate
Loc.Tr("This.Key.Does.Not.Exist", defaultText: "Default Text!"); //< "Default Text!"
XAML
No xmlns declaration is required, the Tr markup extension is available globally.
<TextBlock Text="{Tr 'MainWindow.Text'}" />
<TextBlock Text="{Tr 'MainWindow.Text', DefaultText='(Translation Not Provided)'}" />
<TextBlock Text="{Tr {Binding MyProperty},
                     FormatString='[1]: {0} {2}',
                     FormatArgs={MakeArray {Binding Header},
                                           '\\'}}" />
Translation Config Files
Translation configs store the translated strings for your application. You can use any file
format or syntax you wish by writing an ITranslationLoader implementation for it. Default
loader implementations are provided for JSON & YAML documents.
While it is recommended to keep languages separate for maintainability, there is nothing stopping you from saving multiple languages in the same file.
JSON
Syntax used by the JsonTranslationLoader class:
{
  "MainWindow": {
    "Text": {
      "English": "Hello World!",
      "French": "Salut tout le monde!"
    }
  }
}
Alternative syntax used by the JsonSingleTranslationLoader class:
{
  "$LanguageName": "English",
  "MainWindow": {
    "Text": "Hello World!"
  }
}
JsonSingleTranslationLoader only supports 1 language per file, but the syntax is much easier to write.
YAML
Syntax used by the YamlTranslationLoader class:
MainWindow:
  Text:
    English: "Hello World!"
    French: "Salut tout le monde!"
| 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. | 
| .NET Standard | netstandard2.1 is compatible. | 
| MonoAndroid | monoandroid was computed. | 
| MonoMac | monomac was computed. | 
| MonoTouch | monotouch was computed. | 
| Tizen | 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.1- No dependencies.
 
NuGet packages (5)
Showing the top 5 NuGet packages that depend on radj307.Localization:
| Package | Downloads | 
|---|---|
| VolumeControl.SDK Official Addon SDK for the Volume Control application. | |
| radj307.Localization.WPF WPF markup extensions and converters for radj307.Localization | |
| radj307.Localization.Yaml YAML support for radj307.Localization | |
| radj307.Localization.Json JSON support for radj307.Localization | |
| radj307.Localization.Xml XML support for radj307.Localization | 
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on radj307.Localization:
| Repository | Stars | 
|---|---|
| radj307/volume-control 
                                                            Specific-Application Volume Control Hotkeys for Windows.
                                                         |