Verba.Translations 2.2.0

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

Verba — client .NET (Verba.Translations)

Un singur pachet, două roluri:

  • build — la fiecare dotnet build urcă cheile noi (cu token write) și aduce traducerile din Verba în fișierele de resurse (.resx sau .json). Fără tool global, fără PATH, fără target propriu în .csproj;
  • runtime (OTA, opțional) — textele modificate în Verba apar în aplicația care rulează, fără redeploy.

Integrare

dotnet add package Verba.Translations

verba.json lângă .csproj (se comite):

{ "project": "slug-proiect" }

Tokenuri, căutate în ordine (fișierele și appsettings lângă verba.json, sau appsettings din <VerbaAppSettingsDir>../Host</VerbaAppSettingsDir> pentru o bibliotecă de UI al cărei host are appsettings-ul):

env fișier (gitignored) appsettings(.Development).json
read (fetch) VERBA_TOKEN .verba-token "Verba": { "Token": "…" }
write (push) VERBA_WRITE_TOKEN .verba-write-token "Verba": { "WriteToken": "…" }

Push (cod → Verba)

Cu token write, fiecare build face întâi push, apoi fetch: cheile care există doar în fișiere se creează în Verba cu textele lor, valorile goale din Verba se completează. Ce e deja în Verba nu se suprascrie (Verba e sursa de adevăr), iar cheile șterse în Verba nu reînvie. Fără token write, fetch-ul rescrie fișierele cu ce e în Verba — o cheie adăugată doar local se pierde.

  • doar push, fără build: dotnet build -t:VerbaPush
  • fetch fără push automat: -p:VerbaAutoPush=false
  • acoladele: un text fără {0} e trimis cu acoladele dublate ({AAAA} → {{AAAA}}), ca la export să iasă identic.

Ce se deduce

Câmp Implicit
locales din Verba (/manifest, după token)
outDir Resources (relativ la verba.json)
format dotnet-resx dacă în outDir există deja un .resx neutru, altfel dotnet-json
baseName numele acelui .resx (Localization.resx → Localization), altfel Strings
neutralLocale (resx) limba fără {baseName}.{limbă}.resx, altfel limba implicită din Verba

Fișiere: {baseName}.{limbă}.{ext}; limba neutră → {baseName}.resx. Un fișier se rescrie doar dacă s-a schimbat. Orice câmp se poate fixa explicit (plus server pentru self-host).

Fail-soft: fără token / offline / eroare → avertisment, build-ul continuă cu fișierele existente. Oprire: dotnet build -p:VerbaFetchEnabled=false. Alt config: -p:VerbaConfig=cale/verba.json.

Acoladele literale se scriu dublat în Verba (MD-CPE-{{AAAA}}); altfel sunt placeholder-e.

OTA la runtime (opțional)

builder.Services.AddVerbaOta(builder.Configuration.GetSection("Verba"));   // "Verba": { "Token": "<read>" }

În căutarea textelor, Verba întâi, apoi resursa compilată:

VerbaOta.Get(key, culture) ?? ResourceManager.GetString(key, culture) ?? key
  • fără rețea pe calea de randare: dicționar în memorie, înlocuit atomic de un BackgroundService;
  • la fiecare OtaInterval (implicit 1 min) câte o cerere condiționată per limbă — fără schimbări → 304;
  • Verba indisponibil → rămân ultimele texte bune (la pornire: resursele compilate), o singură avertizare;
  • opțional în secțiune: Project, Locales (implicit din token), Server, OtaInterval, OtaEnabled;
  • VerbaOta.Updated — eveniment după aplicarea unui set nou.

Istoric

  • 2.2.0 — OTA la runtime în același pachet (VerbaOta, AddVerbaOta).
  • 2.1.0 — push (automat cu token write, sau -t:VerbaPush); Verba:WriteToken.
  • 2.0.0 — pachet MSBuild (până la 1.x: dotnet tool global verba-fetch).

Dezvoltare în repo

Pachetul se face din VerbaRuntime/ (bibliotecă + build/), cu VerbaFetch/ în tools/. Verba.targets rulează VerbaFetch din sursă (dotnet run), pentru test fără pachet:

<Import Project="/cale/către/Verba/clients/dotnet/Verba.targets" />
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 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. 
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
2.2.0 122 9/29/2026
2.1.0 111 9/29/2026
2.0.0 111 9/29/2026
1.0.1 148 7/2/2026
1.0.0 124 7/2/2026