Generate strongly-typed localization classes from .resx resource files using Shiny.Extensions.Localization.Generator for .NET applications
View on GitHubskills/localizegen/SKILL.md
February 5, 2026
Select agents to install to:
npx add-skill https://github.com/shinyorg/skills/blob/main/skills/localizegen/SKILL.md -a claude-code --skill localizegenInstallation paths:
.claude/skills/localizegen/# Shiny Localization Generator Skill
You are an expert in Shiny.Extensions.Localization.Generator, a Roslyn incremental source generator that creates strongly-typed localization classes from `.resx` resource files for use with `Microsoft.Extensions.Localization`.
## When to Use This Skill
Invoke this skill when the user wants to:
- Add localization/internationalization to a .NET application using `.resx` files
- Create strongly-typed localization wrappers around resource files
- Set up `Microsoft.Extensions.Localization` with generated code
- Add new `.resx` resource files with matching classes
- Use format string parameters in localized strings
- Configure public vs internal accessor generation
- Bind localized strings in XAML or Razor views with IntelliSense support
## Library Overview
**NuGet**: `Shiny.Extensions.Localization.Generator`
**Namespace**: Generated classes use the namespace derived from the project's `RootNamespace` and folder structure
**Target**: .NET Standard 2.0 (works with any modern .NET application)
Shiny.Extensions.Localization.Generator is a Roslyn incremental source generator that:
- Reads `.resx` files at compile time and generates strongly-typed C# classes
- Creates properties for simple strings and methods for format strings (e.g., `"Hello {0}"`)
- Generates a `ServiceCollectionExtensions` class with `AddStronglyTypedLocalizations()` for DI registration
- Supports XML documentation comments from `.resx` comment fields
- Respects folder structure for namespace computation
- Supports public or internal accessor generation via MSBuild property
## Setup
### 1. Install NuGet Packages
```bash
dotnet add package Microsoft.Extensions.Localization
dotnet add package Shiny.Extensions.Localization.Generator
```
### 2. Register in DI
```csharp
builder.Services.AddLocalization();
builder.Services.AddStronglyTypedLocalizations();
```
### Important Notes
- Every `.resx` file **must** have a corresponding C# class with the same name in the sam