Runic.Translations.CommandLine 0.9.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Runic.Translations.CommandLine --version 0.9.1
                    
NuGet\Install-Package Runic.Translations.CommandLine -Version 0.9.1
                    
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="Runic.Translations.CommandLine" Version="0.9.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Runic.Translations.CommandLine" Version="0.9.1" />
                    
Directory.Packages.props
<PackageReference Include="Runic.Translations.CommandLine" />
                    
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 Runic.Translations.CommandLine --version 0.9.1
                    
#r "nuget: Runic.Translations.CommandLine, 0.9.1"
                    
#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 Runic.Translations.CommandLine@0.9.1
                    
#: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=Runic.Translations.CommandLine&version=0.9.1
                    
Install as a Cake Addin
#tool nuget:?package=Runic.Translations.CommandLine&version=0.9.1
                    
Install as a Cake Tool

Runic.Translations.CommandLine

Runic.Translations.CommandLine translates the help, errors, prompts and faults of a Runic.CommandLine app with Runic Translations. It ships English and German text for every framework key, so a German invocation shows no English framework text and you write no key mapping.

using System.Globalization;
using Runic.CommandLine;
using Runic.CommandLine.Generated;
using Runic.Translations;
using Runic.Translations.CommandLine;

ITranslationSnapshot snapshot = await AppTextCatalog.CreateProvider().GetSnapshotAsync("de");
return await new CommandApp(GeneratedCommandCatalog.Create())
{
    Culture = CultureInfo.GetCultureInfo("de"),
    TextResolver = new TranslationCommandTextResolver(snapshot),
}.RunAsync(args);

Framework text comes from the built-in runic-command-line catalog (English and German). Your catalog overlays it: it translates your DescriptionKey values and can override any framework text. Precedence is locale-first: for each locale of the requested locale's fallback chain, your message is tried before the built-in one, and only then the next locale, so the built-in German beats an override your catalog has only in English. A key that neither has returns null, so Runic.CommandLine writes its English text.

Pass an ITranslationManager instead of a snapshot to follow locale switches, or an ITranslationContext with your catalog's ID. To resolve in the invocation culture (CommandApp.Culture) itself, pass a TranslationContextBuilder; the resolver builds one context per culture. With a snapshot, manager or context whose locale names another language than the culture, the text keeps that locale and the resolver reports it once: a warning: line on standard error, so a shipped console app shows it, and a trace warning.

For other languages, register TranslationCommandTextResolver.CatalogRegistration in the builder and attach a TranslationOverlay for TranslationCommandTextResolver.CatalogId, such as French packs:

TranslationContextBuilder catalogs = TranslationContext.CreateBuilder()
    .Add(AppTextCatalog.Registration)
    .Add(TranslationCommandTextResolver.CatalogRegistration)
    .AddOverlay(TranslationOverlay.FromPacks(TranslationCommandTextResolver.CatalogId, packs, [new TranslationOverlayLocale("fr")]));
var resolver = new TranslationCommandTextResolver(catalogs, AppTextCatalog.CatalogId);

Message names

A text key becomes a message name by removing each hyphen and capitalizing the letter after it: help.show-help is help.showHelp, diagnostics.unknown-option is diagnostics.unknownOption and faults.RCLI4000 is unchanged. TranslationCommandTextResolver.GetMessageName applies the rule. Name each input after the framework argument, or after its position:

commands {
  greet = Grüßt eine Person
}
diagnostics {
  unknownOption =
    .input {$option :string}
    {{Unbekannte Option {$option}.}}
}

The Runic.CommandLine README links the framework text key table, which lists every key and its argument names. A message may use only some of the arguments; {$arg0}, {$arg1} and so on name them by position, which also covers diagnostics your app creates. A message is skipped, and the next source of text is used, when it declares an input the framework does not supply or cannot be formatted. Inputs are :string, or :integer and :number for arguments that are invariant numbers.

Name lookup uses ITranslationSnapshot.TryGetKey and TryGetPlaceholders, which compiled snapshots implement. The adapter is trimming- and NativeAOT-compatible.

Product Compatible and additional computed target framework versions.
.NET 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
0.14.0 0 11/18/2026
0.13.0 295 11/16/2026
0.12.0 184 11/15/2026
0.11.0 304 11/14/2026
0.10.0 115 11/13/2026
0.9.1 158 11/9/2026
0.8.0 1,387 10/22/2026
0.7.0-preview.4 309 10/17/2026
0.7.0-preview.3 153 10/17/2026
0.7.0-preview.2 150 10/15/2026
0.7.0-preview.1 122 10/14/2026
0.6.0-preview.7 70 10/12/2026