Noctilocus.SmartFormat
1.0.0-beta.5
dotnet add package Noctilocus.SmartFormat --version 1.0.0-beta.5
NuGet\Install-Package Noctilocus.SmartFormat -Version 1.0.0-beta.5
<PackageReference Include="Noctilocus.SmartFormat" Version="1.0.0-beta.5" />
<PackageVersion Include="Noctilocus.SmartFormat" Version="1.0.0-beta.5" />
<PackageReference Include="Noctilocus.SmartFormat" />
paket add Noctilocus.SmartFormat --version 1.0.0-beta.5
#r "nuget: Noctilocus.SmartFormat, 1.0.0-beta.5"
#:package Noctilocus.SmartFormat@1.0.0-beta.5
#addin nuget:?package=Noctilocus.SmartFormat&version=1.0.0-beta.5&prerelease
#tool nuget:?package=Noctilocus.SmartFormat&version=1.0.0-beta.5&prerelease
Noctilocus
A C# port of the ngx-translate. The port is not one to one and also aims to be more C# friendly where possible.
The library provides you with a TranslateService which combined with a TranslateLoader (HttpLoader built in) enables you to load, compile and display your translations using formatting with keys. For much stronger formatting there exists a supporting package that uses the awesome SmartFormat package.
Packages
| Package | Stable | Pre |
|---|---|---|
| Noctilocus | ||
| Noctilocus.SmartFormat |
Usage
Description
- Noctilocus
- Contains the
abstractions,defaults,primitives,http loaderand theservice.
- Contains the
- Noctilocus.SmartFormat
- Contains the
SmartFormatParser.
- Contains the
Installation:
Noctilocusin projects that you want to use the service or any of the primitives.Noctilocus.SmartFormatin projects that use the service and you want to replace the default parser.
Getting Started
The section will describe how to get started with Noctilocus in a Blazor Wasm using the HttpLoader storing the language files at wwwroot/i18n.
- Add the
Noctilocuspackage.
dotnet add package Noctilocus
- Add the appropriate services to the service provider.
services.AddScoped(sp => new HttpClient() { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
services.AddScoped<TranslateLoader, TranslateHttpLoader>(); // This will use the default options
services.AddScoped<TranslateService>(); // This will use the default parser
- Use the service
TranslateService also supports a "pipe" syntax to get your translation values.
For the tanslation key: hello and value: Hello you can do:
translate.Instant("hello") // prints "Hello"
translate | "hello" // prints "Hello"
For the translation key: welcome, value: Welcome {user}! and param: user.
translate.Instant("hello", new { user = "panos" }) // prints "Welcome panos"!
translate | "hello" | new { user = "panos" } // prints "Welcome panos"!
Contributing
For general contribution information you can read the Raven Tail Contributing document.
Local Development
To develop you need:
- dotnet 9.0 SDK
- Visual Studio or VS Code with the C# extension.
- Configured your IDE for the TUnit library.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 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. |
-
net8.0
- Noctilocus (>= 1.0.0-beta.5)
- SmartFormat (>= 3.6.0)
-
net9.0
- Noctilocus (>= 1.0.0-beta.5)
- SmartFormat (>= 3.6.0)
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 |
|---|