Resharper is suggesting that string literals are localizable
Asked Answered
L

1

17

One of the suggestions of Resharper 6.0 was to localize strings, and if I didn't want a string to be localized, I could suppress the warning by converting it to a verbatim string literal by adding a @.

After upgrading to Resharper 6.1, this doesn't work anymore. Even verbatim string literals are showing the warning.

Disabling localization or suppressing the warnings isn't an ideal option. I do use localization so the warnings are helpful, and I don't want to have the disable comments littered everywhere.

Is there an option to get Resharper 6.1 to ignore verbatim string literals?

Liquorish answered 17/1, 2012 at 19:13 Comment(3)
are you sure that teh string literals that you are using are defined properly as well as being used in the correct place ..?Wargo
@DJKRAZE, What exactly do you mean? Even a simple line such as var test = @"test"; will give the warning.Liquorish
where are you declaring the var statement.. inside the method hopefully.. it's hard to tell what's going on without seeing some actual method or something.. have you looked at compiler setting in resharper as well...??Wargo
L
28

Under ReSharper / Options, go to:

Code Editing -> C# -> Localization

And check "Don't analyse verbatim strings"

Limnology answered 17/1, 2012 at 19:56 Comment(4)
That, or you could turn it to a suggestion instead of a warning in the options menu under "inspection severity".Tim
I was trying to find that - I've had it changed to hide that inspection for so long that I forgot where to find it!Limnology
Awesome, thanks. I don't know why this option didn't carry over in the upgrade, but it's nice to have it back.Liquorish
Shouldn't this be check rather than uncheck to allow the OP to avoid the warnings for string literals?Amplification

© 2022 - 2024 — McMap. All rights reserved.