Sondor.Translations
1.0.12
Prefix Reserved
dotnet add package Sondor.Translations --version 1.0.12
NuGet\Install-Package Sondor.Translations -Version 1.0.12
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="Sondor.Translations" Version="1.0.12" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sondor.Translations" Version="1.0.12" />
<PackageReference Include="Sondor.Translations" />
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 Sondor.Translations --version 1.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Sondor.Translations, 1.0.12"
#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 Sondor.Translations@1.0.12
#: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=Sondor.Translations&version=1.0.12
#tool nuget:?package=Sondor.Translations&version=1.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Sondor Translations
Sondor translations is aims to provide an easy solution to managing translations, offering easy to use solutions for static and dynamic translations.
Options
| Name | Description | Required | Default |
|---|---|---|---|
DefaultCulture |
The default culture the application will use, when not set. | True |
en |
SupportedCultures |
The collection of cultures the application supports. | True |
en, en-GB, en-FR |
UseKeyAsDefaultValue |
When true, returns the translation key when a value is not found and a default value was not provided. | True |
True |
Getting Started
- Add options to your configuration, the default section name of
SondorTranslationOptionscan be overridden when when callingservices.AddSondorTranslations.
{
"SondorTranslationOptions": {
"DefaultCulture": "en",
"SupportedCultures": [
"en",
"en-GB",
"en-US"
],
"UseKeyAsDefaultValue": true
}
}
- Call
services.AddSondorTranslationsto setup the application ready to use translations.
services.AddSondorTranslations(settings: "SondorTranslationOptions",
providers: null);
- Call
application.UseSondorTranslations()to register the request localization middleware.
application.UseSondorTranslations();
- Add
Sondor.Translationsnamespace and addISondorTranslationManagerto your constructor.
using Sondor.Translations;
/// <summary>
/// The example class.
/// </summary>
public class Example {
/// <summary>
/// Creates a new instance of <see cref="Example"/>.
/// </summary>
/// <param name="translationManager">The translation manager.</param>
public Example(ISondorTranslationManager translationManager) {
}
}
- Now, follow the guides below to read translations respective of your chosen method
How to use resource files
- Create the resource (
.resx) file in the desired directory.- Take note of the location, as the namespace path will be required when reading translations.
- When creating the
resxfile, ensure to name it after the culture translations it'll store. Example:Tests.en.resxforenculture translations. - The namespace for the example below -
Sondor.Translations.Tests.
- Open the resource file, I'd recommend using Visual Studio as it provides a user friendly UI.
- Now read a translation as shown below
_translationManager.Translate(key: "key",
location: "Sondor.Translations.Tests",
resource: "Resources.Tests");
How to use JSON file translation provider
- Create translations file
C:\translations\en.json
{
"en": [
{
"Key": "key-1",
"Value": "value-1"
},{
"Key": "key-2",
"Value": "value-2"
},
{
"Key": "key-3",
"Value": "value-3"
}
]
}
- Now read a translation as shown below
await _translationManager.TranslateAsync(key: "key");
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Microsoft.AspNetCore.Localization (>= 2.3.0)
- Microsoft.Extensions.Configuration (>= 9.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.Json (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection (>= 9.0.10)
- Microsoft.Extensions.Localization (>= 9.0.10)
- Microsoft.Extensions.Localization.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.10)
- Serilog.AspNetCore (>= 9.0.0)
- Sondor.Errors (>= 1.1.8)
- Sondor.Options (>= 1.0.4)
- Sondor.Tests (>= 1.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Sondor.Translations:
| Package | Downloads |
|---|---|
|
Sondor.ProblemResults
The Sondor problem result package, sets up common base problem detail results used for building APIs and services. It supports both the legacy method of throwing custom exceptions and the result pattern to ensure a consistent but performant problem detail implementation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.12 | 1,014 | 11/7/2025 |
| 1.0.11 | 910 | 10/4/2025 |
| 1.0.10 | 683 | 9/20/2025 |
| 1.0.9 | 333 | 9/20/2025 |
| 1.0.8 | 284 | 8/17/2025 |
| 1.0.7 | 188 | 8/16/2025 |
| 1.0.6 | 263 | 8/11/2025 |
| 1.0.5 | 610 | 7/24/2025 |
| 1.0.4 | 194 | 6/28/2025 |
| 1.0.3 | 271 | 6/18/2025 |
| 1.0.2 | 279 | 6/18/2025 |
| 1.0.1 | 245 | 5/25/2025 |
| 1.0.0 | 305 | 5/18/2025 |
| 1.0.0-7-add-translation-att... | 555 | 7/24/2025 |
| 1.0.0-3-update-documentation.1 | 205 | 5/20/2025 |
The initial release.