Reputation:
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.
Upvotes: 5
Views: 884
Reputation: 1396
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.
Upvotes: 5