Usage Examples
Code-Behind
Section titled “Code-Behind”var localizer = services.GetRequiredService<MyViewModelLocalized>();
// Simple string propertyConsole.WriteLine(localizer.Welcome);
// Format string methodConsole.WriteLine(localizer.UserGreetingFormat("Allan", "MyApp"));// Output: Hello Allan, welcome to MyApp!XAML Binding (MAUI)
Section titled “XAML Binding (MAUI)”<Label Text="{Binding Localizer.Welcome}" />Blazor / Razor
Section titled “Blazor / Razor”@inject MyViewModelLocalized Localizer
<h1>@Localizer.Welcome</h1><p>@Localizer.UserGreetingFormat(User.Name, "MyApp")</p>Raw Localizer Access
Section titled “Raw Localizer Access”The generated class exposes the underlying IStringLocalizer for edge cases:
// Dynamic key lookup when you need itvar value = localizer.Localizer["SomeDynamicKey"];Configuration
Section titled “Configuration”Generate classes with internal instead of public access:
<PropertyGroup> <GenerateLocalizersInternal>True</GenerateLocalizersInternal></PropertyGroup>AI Coding Assistant
Section titled “AI Coding Assistant”Step 1 — Add the marketplace:
claude plugin marketplace add shinyorg/skills Step 2 — Install the plugin:
claude plugin install shiny-extensions@shiny Coming soon — Copilot plugin install instructions will be added here.