.NET localization: .resx files translated on every build
.resx files are reliable but painful to translate: they are XML, they live in the repository, and every new
language means another file to keep in sync. With Verba.Translations, dotnet build keeps them up to date.
Setup
dotnet add package Verba.Translations
// verba.json, next to the .csproj
{ "project": "my-app" }
Put a read token in .verba-token (git-ignored) or appsettings.Development.json ("Verba": { "Token": "…" }).
The loop
- Developers add keys to the neutral
Localization.resxas usual. - With a write token,
dotnet buildpushes the new keys to Verba. - AI and translators fill the other languages in Verba.
- The next
dotnet buildwritesLocalization.ro.resx,Localization.de.resx… — only when something changed.
Literal braces are written doubled in Verba (MD-{{YYYY}}), so string.Format placeholders ({0}) stay safe.
Fix texts without a redeploy
builder.Services.AddVerbaOta(builder.Configuration.GetSection("Verba"));
var text = VerbaOta.Get(key, culture) ?? Resources.ResourceManager.GetString(key, culture) ?? key;
See the full .NET reference.