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”An AI skill is available for the Localization Generator to help generate localized classes, configure .resx files, and follow best practices directly in your IDE.
Claude Code
claude plugin add github:shinyorg/skillsGitHub Copilot — Copy the localizegen skill file into your repository’s custom instructions.