Skip to content

Make CodeCracker localizable #360

Open
@giggio

Description

When we started CodeCracker we were using the templates from Microsoft. At the time, they did not include a way to localize the library. It does now. Here are the localizable parts of an analyzer on the template now:

In diagnostics.cs:

// You can change these strings in the Resources.resx file. If you do not want your analyzer to be localize-able, you can use regular strings for Title and MessageFormat.
internal static readonly LocalizableString Title = new LocalizableResourceString(nameof(Resources.AnalyzerTitle), Resources.ResourceManager, typeof(Resources));
internal static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormat), Resources.ResourceManager, typeof(Resources));
internal static readonly LocalizableString Description = new LocalizableResourceString(nameof(Resources.AnalyzerDescription), Resources.ResourceManager, typeof(Resources));

In resources.resx:

  <data name="AnalyzerDescription" xml:space="preserve">
    <value>Type names should be all uppercase.</value>
    <comment>An optional longer localizable description of the diagnostic.</comment>
  </data>
  <data name="AnalyzerMessageFormat" xml:space="preserve">
    <value>Type name '{0}' contains lowercase letters</value>
    <comment>The format-able message the diagnostic displays.</comment>
  </data>
  <data name="AnalyzerTitle" xml:space="preserve">
    <value>Type name contains lowercase letters</value>
    <comment>The title of the diagnostic.</comment>
  </data>

We need to update all analyzers so strings are localizable, and then start a localization initiative.

Note: Code fix providers don't have localization on the template, but I believe we can use the same strategy.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions