Localization inspection options 5.0 - moving a string literal to resources

Hi.
I've just moved from version 4.5 to 5.0 on visual studio 2010.
My major need for resharper is localization.

In previous versions of resharper (with RGreatX) string.format() with a string literal would raise a warning offering to move the string into my resources. This no longer happens.
The following code doesn't offer a warning.
if (!equipment.SeatAvailable) seat = "n/a";

On the other hand setting a control text property eg myEdit.Text = "n/a"; does raise the warning.

I wouldn't mind so much if there were a context menu option "Move string to resource" after selecting a string, but there isn't. Also there's nothing in ReSharper's main menu either.

Am I missing something somewhere please?

22 comments
Comment actions Permalink

Hello,

Does it help to open the Properties tool window for the project and set the
Localizable Inspector to use pessimistic analysis?


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

Yes that worked
Thank you Serge

0
Comment actions Permalink

(See bottom of post for a workaround.)

Your solution (set project options to Pessimistic) didn't fix my situation. As you can see from the assembled screenshot, the regular menu (Alt+Enter) only shows me the option to Split string. If I do the Refactor This menu (Ctrol+Shift+R), I get the option to Move to Resource. Why don't I get options like that shown at http://www.jetbrains.com/resharper/whatsnew/index.html#Internationalization (second screenshot)?
ResharperL10nIssue.jpg
http://www.jetbrains.com/resharper/features/screenshots/50/localization.png

Thanks to Alexander, the workaround for Resharper 5.0 is to set "Don't localize verbatim  strings" in ReSharper | Options | Languages | C# | Localization. Supposedly, the latest nightly builds of 5.1 have fixed the problem.

0
Comment actions Permalink

You just need to use pessimistic localization inspector. Look at the attached screen shots for more information.



Attachment(s):
warning.png
solutionExplorer_properiesTab.png
0
Comment actions Permalink

Thanks for the screenshots, but you don't understand; I have set it to use the pessimistic localization inspector and I still am not getting the correct menu.

0
Comment actions Permalink

Does parent member or type have LocalizableAttribute(false)? Could you provide simple solution for investigation?

0
Comment actions Permalink

The Localizable attribute is never used in the solution, so no, a parent type does not set it to false.

I've attached the simplest possible example of a solution which, on my machine, does not provide the localization menu.



Attachment(s):
ResharperLocalization.zip
0
Comment actions Permalink

I added resx file into the sample project and have this menu
ReSharperQuickFixes.png
I tested on the JetBrains ReSharper 5.1 Full Edition Build 5.1.1704.7 on 2010-06-04T21:37:00
Try to use ReSharper 5.1 from Nightly+Builds

0
Comment actions Permalink

@Pat Kujawa
I'm Sorry to be Off Topic (did not found something like personal message) but I would like to ask what Visual Studio Theme you are using because I'm looking for a dark theme and I like your colors.

Best regards
Sven

0
Comment actions Permalink

@Sven: No worries; maybe others like the theme as well. I have had a hard time finding a great dark theme, and so this one has a number of personal customizations (particularly for Resharper-related things).

I usually always start with a basic theme created from a great visual studio theme generatorhttp://frickinsweet.com/tools/Theme.mvc.aspx. In my case, I had bg: #111, fg: #cfcfcf, main:#f7ae02, and "low contrast".

Scott Hanselman also has a good blog post on themes in VS.

Anyway, I've attached it for you to import, if you want. The font is Consolas (on a PC running Windows 7).



Attachment(s):
DarkTheme.vssettings.zip
0
Comment actions Permalink

Thank you very much Pat. =)

0
Comment actions Permalink

What about "Move to resource" menu?

0
Comment actions Permalink

I upgraded to the latest nightly build and deleted all .resharper files in the project and I still don't get the full menu.

0
Comment actions Permalink

What color of square at the top-right corner? Do you have resx file in the project? Do you have warning (wave underlining) 'Localizable string'? Could you use refactoring "Move to resource" for the string?

0
Comment actions Permalink

I don't know what you're talking about with the "color of square at the top-right corner". If you mean the bottom-right corner and the solution analysis, I have it turned off becuase it appeared to be slowing down VS.

Yes, there is a resx file in the project. No, there is no warning under the string. Yes, I can use "Move to resource", but only with the "Refactor This" context menu. As I have been saying (and my previous screenshot shows), I want to know why the primary Resharper context help does not appear the same as what is advertised (see my first post).

0
Comment actions Permalink

top-right corner top-right_corner.png
Please check setting "Enable code analysis" at the ReSharper | Options | Code Inspection | Settings, it should be checked.

0
Comment actions Permalink

I do have Enable code analysis checked, and the square is yellow.

I gave up on the nightly build because I was having trouble saving my options, so I've reverted to 5.0.

0
Comment actions Permalink

Please call "Find Code Issues" from context menu in Solution Explorer for the code file, export result data to the clipboard and it here.

0
Comment actions Permalink

1 issue found
  Compiler Warnings (1 issue)
    <ClassLibrary1>\Class1.cs (1 issue)
      Field 'test' is never used

I was looking for a Find Issue category related to localization, but there isn't one in my list.

0
Comment actions Permalink

Last attempt to resolve this problem. Please check "Element is localizable" value at the ReSharper | Options | Code Inspection | Inspection Severity | Potential Code Quality Issues, it should not be "Do not show".

0
Comment actions Permalink

Please send me your ReSharper settings file UserSettings.xml (you can find it at the %AppData%\JetBrains\ReSharper\v5.1\vs10.0\)

0

Please sign in to leave a comment.