shinyorg/templates/localizegen
Claude Code and agent skill by shinyorg/templates
- community
Checking that the SKILL.md file is still in the repository.
Generate strongly-typed localization classes from .resx resource files using Shiny.Extensions.Localization.Generator for .NET applications
Install
npx vskill@latest install shinyorg/templates/localizegenSKILL.md
The same SKILL.md was published earlier as shinyorg/templates/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
.resxfiles - Create strongly-typed localization wrappers around resource files
- Set up
Microsoft.Extensions.Localizationwith generated code - Add new
.resxresource 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
.resxfiles 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
ServiceCollectionExtensionsclass withAddStronglyTypedLocalizations()for DI registration - Supports XML documentation comments from
.resxcomment fields - Respects folder structure for namespace computation
- Supports public or internal accessor generation via MSBuild property
Setup
1. Install NuGet Packages
2. Register in DI
Important Notes
- Every
.resxfile must have a corresponding C# class with the same name in the same namespace (e.g.,MyViewModel.resxrequiresMyViewModel.cs) - If the associated class does not exist, the generated code will produce a compile error
- Only the default locale
.resxfile is processed (e.g.,MyViewModel.resx), locale-specific files likeMyViewModel.fr-ca.resxare handled by the localization framework at runtime - The generator produces a
{ClassName}Localizedclass (e.g.,MyViewModelLocalized) for each.resxfile
How It Works
Directory Structure
Generated Output
Resource Key Rules
- Dots (
.), hyphens (-), and spaces in resource keys are converted to underscores (_) - Format string parameters like
{0},{1}are detected automatically - When format parameters are present, a method is generated instead of a property
- Method names get a
Formatsuffix unless the key already ends withFormat
Code Generation Instructions
When working with this library:
1. Resource Files (.resx)
Create .resx files alongside their associated C# class:
2. Associated Class
The class must exist with the same name and namespace as the .resx file:
3. Generated Class Structure
The generator creates:
4. XAML Binding
Bind in XAML with full IntelliSense:
5. File Organization
Place files following standard .NET conventions:
- Resource files: alongside their associated class file
- Locale variants: same location with locale suffix (e.g.,
MyClass.fr-ca.resx) - Folder structure determines namespace:
Folder1/MyClass.resx→RootNamespace.Folder1
Configuration
Internal Accessor
To generate classes with internal instead of public access modifier:
Usage Examples
Simple property access:
Format string method:
XAML binding in MAUI:
ASP.NET/Blazor usage:
Best Practices
- Always create the associated class - Every
.resxfile must have a matching C# class or a compile error will occur - Use comments in .resx - Comments become XML documentation on generated properties/methods
- Use format parameters for dynamic content -
{0},{1}etc. generate type-safe methods - Use default locale for generation - Only
ClassName.resxis processed;ClassName.fr-ca.resxis for runtime localization - Inject the Localized class - Use DI to inject
{ClassName}Localized, notIStringLocalizerdirectly - Expose the raw localizer - The generated class exposes
Localizerproperty for edge cases needingIStringLocalizer - Namespace follows folder structure - Organize
.resxfiles in folders to match your namespace conventions
Reference Files
For detailed templates and examples, see:
reference/templates.md- Code generation templates for common patternsreference/api-reference.md- Full API surface, MSBuild properties, and troubleshooting
Common Packages
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingProjectTemplates/ShinyAspNet/skills/localizegen/SKILL.md
Popularity
- Repository stars
- 150
- Repository forks
- 14
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 17 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/shinyorg/templates/localizegen)