Metaphrase.SmartFormat 1.0.0-beta.37

This is a prerelease version of Metaphrase.SmartFormat.
dotnet add package Metaphrase.SmartFormat --version 1.0.0-beta.37
                    
NuGet\Install-Package Metaphrase.SmartFormat -Version 1.0.0-beta.37
                    
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="Metaphrase.SmartFormat" Version="1.0.0-beta.37" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Metaphrase.SmartFormat" Version="1.0.0-beta.37" />
                    
Directory.Packages.props
<PackageReference Include="Metaphrase.SmartFormat" />
                    
Project file
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 Metaphrase.SmartFormat --version 1.0.0-beta.37
                    
#r "nuget: Metaphrase.SmartFormat, 1.0.0-beta.37"
                    
#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 Metaphrase.SmartFormat@1.0.0-beta.37
                    
#: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=Metaphrase.SmartFormat&version=1.0.0-beta.37&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Metaphrase.SmartFormat&version=1.0.0-beta.37&prerelease
                    
Install as a Cake Tool

Metaphrase

Build Action Publish Action License .NET 8 .NET 9 Downloads

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. You format the strings keys. For a much stronger formatting a package that uses the awesome SmartFormat project is provided.

Packages

Package Stable Pre
Metaphrase Metaphrase Metaphrase
Metaphrase.SmartFormat Metaphrase.SmartFormat Metaphrase.SmartFormat

Usage

Description

  • Metaphrase
    • Contains the abstractions, defaults, primitives, http loader and the service.
  • Metaphrase.SmartFormat
    • Contains the SmartFormatParser.

Installation:

  • Metaphrase in projects that you want to use the service or any of the primitives.
  • Metaphrase.SmartFormat in projects that use the service and you want to replace the default parser.

Getting Started

The section will describe how to get started with Translate in a Blazor Wasm using the HttpLoader storing the language files at wwwroot/i18n.

  1. Add the Metaphrase package.
dotnet add package Metaphrase
  1. 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
  1. 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:

  1. dotnet 9.0 SDK
  2. Visual Studio or VS Code with the C# extension.
  3. Configured your IDE for the TUnit library.
Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.0-beta.37 42 2/24/2026
1.0.0-beta.11 52 2/6/2026
1.0.0-beta.8 45 2/3/2026