roslynator
roslynator copied to clipboard
I'm planning to add localization support for these analyzers.
These are the roadmap I'm planning to do:
- [ ] Add a LocalizableResources project. This project contains the main Resources.resx file and several localized files such as Resources.zh-CN.resx.
- [ ] Move all diagnostic strings which are currently not been deprecated to the localized Resources.resx files.
- [ ] Change the
CodeGeneration.DiagnosticDescriptorsGenerator
file and replace the literal strings to localizable strings which all reference the LocalizableResources project.
I'm just planning to do this but find that this is not a tiny task. So I'm here to discuss this with you for your approval. If you agree to do this, I'll start to add the localization support for this repository. I'll add en-US
and zh-CN
for the first version and hope the community to add others.
Hi,
this sounds like a good idea. I'm currently busy with releasing Roslynator 3.0. When I'm done with it I'll be back to discuss details. Thanks for understanding.
https://github.com/dotnet/roslyn/blob/master/docs/analyzers/Localizing%20Analyzers.md
@JosefPihrt Thanks for your documentation. I also add analyzers and code fixes with localizations in my NuGet packages for correct package usages. So I've read all the localization docs and glad to localize my favorite analyzers - Roslynator.
You can view one of them here:
@JosefPihrt So, are you ready for the localization?
Sorry for the delay, I was busy.
I would propose following structure of resources:
- project Common
- Resources.resx
- common resources
- this project is referenced in all projects so it is not necessary to add new project LocalizableResources
- Resources.resx
- projects Analyzers, Formatting.Analyzers, CodeAnalysis.Analyzers
- AnalyzersResources.resx
- generated from Analyzers.xml
- resource's name should have format <IDENTIFIER>_Title, <IDENTIFIER>_MessageFormat and <IDENTIFIER>_Description (e.g. AddBracesWhenExpressionSpansOverMultipleLines_Title)
- AnalyzersResources.resx
- project CodeFixes
- CodeFixesResources.resx
- project Refactorings
- RefactoringsResources.resx
Analyzer's localized Title, MessageFormat and optionally Description should be contained in Analyzers.xml file in a following format (after "Summary" element):
<LocalizedResources>
<LocalizedResource Language="cs">
<Title>Přidat závorky (pokud výraz zahrnuje více řádků).</Title>
<MessageFormat>Přidat závorky k {0} (pokud výraz zahrnuje více řádků).</MessageFormat>
<Description></Description>
</LocalizedResource>
<LocalizedResources>
Let me know what do you think about this proposal.