What the agent does
The agent reads the app's rendering model first, because localization in Blazor depends on it. In an app laid out like the BlazorWebAppMovies sample in dotnet/blazor-samples, the project targets net10.0 with nullable and implicit usings on and BlazorDisableThrowNavigationException set, and references Microsoft.EntityFrameworkCore.SqlServer, the QuickGrid EF adapter and the EF tools. Program.cs registers a DbContextFactory on a LocalDB connection string, AddQuickGridEntityFrameworkAdapter, AddRazorComponents().AddInteractiveServerComponents(), seeds the database, then UseHttpsRedirection, UseAntiforgery, MapStaticAssets and MapRazorComponents<App>().AddInteractiveServerRenderMode(). Components/App.razor renders <html lang="en"> with <Routes />; MainLayout.razor has an "About" link, NavMenu.razor the brand "Sci-fi Movies" and the links Home, Counter, Weather and Movies. Pages/MoviePages/Index.razor is @rendermode InteractiveServer with a QuickGrid of Title, Release Date, Genre, Price and Rating columns and a five-row paginator; Create.razor and Edit.razor are statically rendered EditForms with labels "Title:", "Release Date:", "Genre:", "Price:" and "Rating:" and a DataAnnotationsValidator. Models/Movie.cs carries [Required], [StringLength(60, MinimumLength = 3)], [RegularExpression] on genre and rating, [Range(0, 100)] and [DataType(DataType.Currency)], all with default English messages. There are no tests and no workflows.
The server-side setup follows the ASP.NET Core localization middleware. The agent adds the Microsoft.Extensions.Localization package, builder.Services.AddLocalization(options => options.ResourcesPath = "Resources"), and before MapRazorComponents a RequestLocalizationOptions with SetDefaultCulture("en-US"), AddSupportedCultures and AddSupportedUICultures for en-US and es-ES, passed to app.UseRequestLocalization. For the choice to persist across the interactive circuit, App.razor gets a @code block that takes HttpContext as a cascading parameter and appends the .AspNetCore.Culture cookie built with CookieRequestCultureProvider.MakeCookieValue from the current cultures, and <html lang> reads CultureInfo.CurrentUICulture.Name. A minimal API endpoint GET /Culture/Set with culture and redirectUri parameters sets the same cookie and returns Results.LocalRedirect, and a Components/CultureSelector.razor with a <select> of the two cultures navigates to it with forceLoad: true, placed in the layout's top row beside the About link.
Strings move into .resx files named after the component that uses them: Resources/Components/Layout/NavMenu.resx and NavMenu.es.resx for the brand and the four links, Resources/Components/Pages/MoviePages/Create.resx for the labels and the button, and the same for Index.razor, where the QuickGrid columns get Title="@Loc["ReleaseDate"]" instead of the literal. Each component injects IStringLocalizer<T> for itself, and _Imports.razor gains @using Microsoft.Extensions.Localization. Validation messages move too: the attributes in Movie.cs get ErrorMessageResourceType = typeof(MovieResources) and ErrorMessageResourceName keys, with Resources/Models/MovieResources.resx and its Spanish twin, so the ValidationSummary on the create form speaks the selected language. Dates and the price already format through the current culture, and the agent notes that DataType.Currency renders the culture's currency symbol, which a store that prices in one currency may not want.
The sandbox is Linux and the sample's database is SQL Server LocalDB, so the agent installs the .NET 10 SDK with the dotnet-install.sh script, runs dotnet build and dotnet format --verify-no-changes, and checks the resx keys against every Loc[...] reference with a script. It states in the pull request that the pages were not exercised at runtime, and what a maintainer with a SQL Server would check: the selector on the layout, the Spanish labels on /movies/create, and a validation error in Spanish.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add localization to this Blazor Web App with Spanish as the second language. Read the project file, Program.cs, Components/App.razor, Components/Routes.razor, Components/_Imports.razor, Components/Layout/MainLayout.razor and NavMenu.razor, every page under Components/Pages including MoviePages, Models/Movie.cs and appsettings.json first. Add the Microsoft.Extensions.Localization package, AddLocalization with a Resources path, request localization with en-US as the default and es-ES as a supported culture and UI culture placed before MapRazorComponents, a cookie written from App.razor through the cascading HttpContext so the circuit keeps the culture, an html lang attribute that follows the UI culture, a /Culture/Set endpoint that stores the choice and redirects, and a CultureSelector component in the layout. Move the navigation, layout and movie page strings into resx files per component read through IStringLocalizer, and move the data annotation messages on the Movie model into a resource class. Install the .NET SDK the project targets, run dotnet build and dotnet format --verify-no-changes, check that every resource key referenced exists in both languages, and open a pull request that lists the resource files, says the app was not run because it needs SQL Server, and names what to check at runtime.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The pull request changes the project file, Program.cs, App.razor, _Imports.razor, MainLayout.razor, NavMenu.razor, the five movie pages and Movie.cs, and adds Components/CultureSelector.razor and a Resources/ tree with an English and a Spanish .resx per component plus the model's resource class. Its description lists each resource file with its key count, quotes the build and format output, and says plainly that the app was built but not run.
A reviewer with a SQL Server runs the app, switches the selector, and checks the nav, the create form's labels and a validation message in Spanish. They also decide two things the agent flags: whether the price should format in the culture's currency or stay in one, and whether the Weather and Counter pages, which the sample keeps from the template, are worth localizing.
From then on a new string is a key in two .resx files and a Loc[...] reference, and a third language is one more culture in Program.cs and one more .resx per component.
Run it on every new language request
A maintainer who takes language requests as GitHub issues adds an automation to the Project with a github trigger on issues.labeled, the label i18n, and this prompt with the language left to the issue. The trigger appends the issue after the prompt and fills in no placeholder, so the agent reads the culture from the issue text ("French" adds fr-FR and a .fr.resx beside each resource) while the prompt stays fixed. Only an issue labelled by an owner, member or collaborator fires it, and the automation's max_runs_per_hour caps how many it starts in an hour.
A team with several Blazor apps sends this body once per repository from its own server, each a POST /o/{org}/sessions with that repository in resources and a request_id that is a UUID v5 of the repository's full name, so a retried call returns the run already started. Each run reads its own render modes: an app with a WebAssembly client project gets the client-side setup with BlazorWebAssemblyLoadAllGlobalizationData as well, and an app already calling AddLocalization gets only the new culture and resources.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
Blazor localization has more moving parts than a web framework with one rendering mode: the middleware order, a cookie that must exist before the interactive circuit starts, a selector that works under static rendering, resx naming that must match the component namespace, and validation attributes that only read resources through a typed class. The agent reads every component and the model, makes those choices consistently, and proves the build and the key coverage in its own sandbox with the SDK the project targets.
What it cannot do, run a LocalDB app on Linux, it says, and the pull request names the three runtime checks that remain. A team with several apps starts the same request against each and gets pull requests that differ only in the strings each app has.
Frequently asked questions
Why write the culture cookie from App.razor?
The localization middleware sets the culture per HTTP request, but an interactive server circuit lives beyond the request that started it. Writing the .AspNetCore.Culture cookie during the initial render, through the cascading HttpContext, means the circuit and every later request agree on the culture. The /Culture/Set endpoint changes that cookie and redirects, which is why the selector navigates with forceLoad: true.
How are the data annotation messages localized?
Through ErrorMessageResourceType and ErrorMessageResourceName on each attribute in Movie.cs, pointing at a generated resource class, which DataAnnotationsValidator reads without any MVC services. The create and edit forms then show the Spanish message in the ValidationSummary and under each field.
Why was the app not run?
The sample uses SQL Server LocalDB, which exists only on Windows, and the sandbox is Linux without Docker. The agent builds, formats and checks every resource key, and lists what a maintainer should click through. A follow-up could swap the connection to a PostgreSQL or SQLite provider for a smoke run, but that is a different change from localization.
What about dates and prices?
They already format through CultureInfo.CurrentCulture, so a Spanish visitor sees a 5 December release date as 5/12/2026 rather than 12/5/2026, and a decimal comma on the price. Because DataType.Currency also swaps the currency symbol, the pull request asks whether prices should keep one currency by formatting with a fixed culture, which is one line in the column.
More Blazor jobs
The same job on other stacks
- Add i18n to a Chrome Extension from a Linear Issue (Chrome extension)
- Add i18n to a CodeIgniter 4 App (CodeIgniter)
- Add i18n to a Docusaurus Site (Docusaurus)