| name | resource-texts |
| description | Add or update localized resource texts in Reihitsu. Use this when introducing new analyzer or code-fix strings in the .resx-based resource system. |
Reihitsu resource texts
Use this skill when you add, rename, or update localized strings for analyzers or code fixes.
Goal
Keep resource texts consistent across:
- the
.resx source of truth
- the handwritten wrapper classes
- the analyzer/code-fix call sites
Resource locations
Analyzer texts
Reihitsu.Analyzer\AnalyzerResources.resx
Reihitsu.Analyzer\AnalyzerResources.cs
Analyzer resources usually contain:
RH####Title
RH####MessageFormat
These are consumed through AnalyzerResources.ResourceManager and LocalizableResourceString.
Code-fix texts
Reihitsu.Analyzer.CodeFixes\CodeFixResources.resx
Reihitsu.Analyzer.CodeFixes\CodeFixResources.cs
Code-fix resources usually contain:
These are consumed through CodeFixResources.RH####Title.
Required workflow
When adding a new resource text:
- Add the new key to the correct
.resx file.
- Add the matching property to the correct handwritten wrapper class.
- Use the new property from analyzer or code-fix code.
- Keep naming aligned with the diagnostic ID.
- Build and run the relevant tests.
Wrapper rules
The resource wrapper files are handwritten source files, not generated artifacts.
- Do not create or restore
.Designer.cs files.
- Do not add
<auto-generated> comments.
- Do not reintroduce
ResXFileCodeGenerator, LastGenOutput, AutoGen, or related project metadata.
- Keep the wrapper classes as normal
internal static class types.
- Keep using
ResourceManager plus string-returning properties.
Naming rules
- Analyzer titles:
RH####Title
- Analyzer messages:
RH####MessageFormat
- Code-fix titles:
RH####Title
Use the same key name:
- in the
.resx entry
- in the wrapper property
- in the consuming code
Style rules
- Match the repository's current C# style.
- Write normal XML documentation comments for the class, shared properties, and helper method.
- Keep per-resource property comments short and mechanical.
- Preserve the existing public surface of the wrapper classes unless the task explicitly changes it.
- Keep the resource base names unchanged:
Reihitsu.Analyzer.AnalyzerResources
Reihitsu.Analyzer.CodeFixResources
Example
If you add a new analyzer rule RH9999:
- Add
RH9999Title and RH9999MessageFormat to Reihitsu.Analyzer\AnalyzerResources.resx.
- Add these properties to
Reihitsu.Analyzer\AnalyzerResources.cs:
internal static string RH9999Title => GetString(nameof(RH9999Title));
internal static string RH9999MessageFormat => GetString(nameof(RH9999MessageFormat));
- Reference them from analyzer code with:
nameof(AnalyzerResources.RH9999Title)
nameof(AnalyzerResources.RH9999MessageFormat)
If you add a matching code fix:
- Add
RH9999Title to Reihitsu.Analyzer.CodeFixes\CodeFixResources.resx.
- Add this property to
Reihitsu.Analyzer.CodeFixes\CodeFixResources.cs:
internal static string RH9999Title => GetString(nameof(RH9999Title));
Validation
Use the repository's normal validation commands:
dotnet build Reihitsu.sln -c Release --verbosity minimal
dotnet test Reihitsu.Analyzer.Test\Reihitsu.Analyzer.Test.csproj -c Release --verbosity minimal
If the change touches code fixes or formatter-coupled behavior, also run the additional relevant test project.
What to avoid
Do not:
- edit only the
.resx file and forget the wrapper property
- add wrapper properties without adding the matching
.resx key
- put analyzer texts into
CodeFixResources
- put code-fix texts into
AnalyzerResources
- fall back to string literals in analyzer or code-fix implementations when a resource should be used