Internationalization has traditionally been an unwanted hurdle for .NET developers, as it annoyingly involves extracting strings to resource files and maintaining sets of resource items across many different cultures.

ReSharper saves time spent on internationalization with its refactorings, navigation, code inspections and quick-fixes for resx files and resource usages in C# and VB.NET code, as well as in ASP.NET and XAML markup.

ReSharper detects strings that you can move to resource files

Highlighting localizable strings

ReSharper detects strings that you can localize, highlights them, and helps you move them to a resource file.

Depending on your project settings, ReSharper can highlight all hard-coded string literals, or only those explicitly marked with Localizable(true).

Moving a localizable string to a resource file

Moving strings to resource files

When ReSharper finds a localizable string, it helps you move it to a resource file as quickly as possible. You can optionally search for identical strings and refactor them to use the new resource item.

Depending on your project settings, strings that you can move to a resource file may or may not be highlighted with a curly underline. If a string is not highlighted, press Ctrl+Shift+R and select the Move to Resource refactoring. If a string is highlighted with a curly underline, as it is in the screenshot above, you can press Alt+Enter and launch the refactoring directly from the list of quick-fixes.

In addition to strings used in C# or VB.NET code, ReSharper is able to process strings from markup files in web applications and arbitrary HTML strings.

Refactorings available for resource entries


In addition to moving strings to resource files, ReSharper provides a number of other internationalization refactorings:

  • Move Resource refactoring moves existing resource entries between resource files.
  • Rename Resource helps change the value of the name attribute in a resource entry.
  • Inline Resource deletes a resource entry from a resource file and substitutes all its usages with the original string.
  • Safe Delete Resource attempts to delete a resource entry along with all its usages without breaking the code. If Resharper finds out that some usages can not be auto-deleted safely, it suggests that you edit them manually before applying the refactoring.

For details on other refactorings provided in ReSharper, see Refactorings.

ReSharper is able to display all code issues that it detects in resource files

Code inspection in resource files

ReSharper provides a number of code inspections that help reveal common issues with resource entries.

Specifically, ReSharper warns you whenever a specific resource value is not overridden in a specific culture, or it is overridden with the same name that is used in the culture-neutral resource file. ReSharper make you aware of duplicate resource names in a single resource file, and it's even able to detect missing or redundant format string placeholders in resource values.

ReSharper displays highlighting in the text editor when it detects issues like these. In addition, you can glance through (and navigate to) all issues in resource files using ReSharper's Find Code Issues feature.

Finally, ReSharper provides quick-fixes that you can use to resolve these issues in resource files right away.

ReSharper finds usages of resource entries in C# and VB.NET code, as well as in ASP.NET markup

Finding usages of resources

ReSharper's Find Usages feature perfectly works with resources. You can search for occurrences of a resource entry both from the code and from resource files.

Navigate between culture-specific resource files

Navigation between cultures and resources

ReSharper's Go to Derived Symbols and Go to Base features help you navigate from resource entries in a culture-neutral resource file to corresponding entries in culture-specific resource files, and vice versa.

ReSharper shows the structure of a resource file

Resource file structure

ReSharper provides a specialized version of the File Structure tool window for viewing the structure of resource files. It lists all entries in a resource file, visualizing resource IDs, resource text in the current culture, and resource comments (if any). In addition, this tool window specifies whether resource entries are overridden in other cultures, and whether they contain format placeholders.

Note on shortcuts

All keyboard shortcuts provided in this page are available in ReSharper's default "Visual Studio" keymap. For details on ReSharper's two keymaps, see ReSharper Documentation.