Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper localize complex strings

How can I get Resharper to shove format strings into the resource file? I have a MessageBox dialog that displays dynamic information like so:

MessageBox.Show(
    string.Format(
        "You have purchased '{0}' ({1}).  Currently, the value of {0} is {2:C}/ share.",
        stock.Symbol, stock.CompanyName, stock.ValuePerShare), Resources.FrmMain_btnVoting_Click_Vote_Purchase, MessageBoxButtons.OK, MessageBoxIcon.Information);

Note that the caption was easily localized to a resource file by Resharper, but I can't even get the option for the message body. Does the format markup automatically make this string non-localizable? I wouldn't think so. I'd hate to have to write my own code to work with the resource file if I can figure out how to make Resharper just send it there like it did for the other string.

like image 881
Jeremy Holovacs Avatar asked May 05 '13 14:05

Jeremy Holovacs


1 Answers

If you want to localize the message you can use the Move To Resource refactoring by pressing Ctrl+R, Ctrl+O after cursor was set on message string.

like image 115
thersch Avatar answered Nov 14 '22 19:11

thersch