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 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)
.
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.
In addition to moving strings to resource files, ReSharper provides a number of other internationalization refactorings:
name
attribute
in a
resource entry.
For details on other refactorings provided in ReSharper, see Refactorings.
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'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.
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 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.
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.