Localization, Move to resource
Thanks for your "Move to resource" feature, that is what I have been missing in R# for a long time.
I would like to have more settings for it, because now I have just too many suggestions.
For example I would like to turn it off when the string constant is used in == and != operators,
like when working with INotifyPropertyChange:
private void OnPropertyChangedEvent(object sender, PropertyChangedEventArgs e)
{
RefreshTextContent();
if (e.PropertyName == "Type")
{
BindType();
}
}
Another set of usages where I don't want localization is when the string is used as an index,
for example as a name of a column
DataRow r;
...
r["ID"] = 42;
And another strings I usually don't want to localize are those that do not contain any letters, like in
string text = string.Format("{0} : {1}", property.Name, property.Type);
Maybe I will think of more, maybe someone else will, please consider these settings.
Please sign in to leave a comment.
You could mark any string as non localizable by:
1. External annonations for Parameter or Property from any assembly without source code;
2. Use LocalizableAttribute(false) by Quick fixes or manually;
3. Convert string to constant literal;
4. Set the setting ReSharper | Options | C# | Localization | Dont analyse verbatim strings @"Hello world" and convert string to vermatim by context action;
For example for the PropertyChangedEventArgs you could add next text into the %Program Files%\JetBrains\ReSharper\v5.0\Bin\ExternalAnnotations\System\System.I18n.xml
Also you could fix parameter for the DataRow indexer by external annotations.
PS. External annotations for DataRow and PropertyChangedEventArgs will be available in the next nightly build.
These settings are useful; nevertheless, please consider my suggestions.
Designer files of a form has many issues realted to the resources:
private void InitializeComponent()
{
resources.ApplyResources(this.btnClose, "btnClose"); -> issue
this.btnClose.Name = "btnClose"; -> Control.Name is a issue this.lstKeyValues.Name = "lstKeyValues"; resources.ApplyResources(this, "$this"); this.Name = "KeyValueDialog";
}
Regards
Martyn