Skip to content

Commit 0a43c65

Browse files
authored
Merge pull request #12976 from ghogen/resources
Add section for new Resources Explorer
2 parents 4c7e17d + 2fb6aeb commit 0a43c65

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

docs/ide/managing-application-resources-dotnet.md

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Manage application resources
33
description: Manage application resources files that aren't part of the compilation process in Visual Studio, such as icon files or audio files.
44
ms.custom: engagement-fy23
5-
ms.date: 7/16/2024
5+
ms.date: 8/26/2024
66
ms.topic: conceptual
77
f1_keywords:
88
- msvse_resedit.dlg.SetCustomTool
@@ -25,9 +25,6 @@ Resource files are files that are part of an application but are not compiled, f
2525
> [!CAUTION]
2626
> Resources in `.resx` files may be serialized using `BinaryFormatter`, which is [not secure](/dotnet/standard/serialization/binaryformatter-security-guide). Include only those `.resx` files in your build process that you trust.
2727
28-
> [!NOTE]
29-
> This topic applies to Visual Studio on Windows. For Visual Studio for Mac, see [Managing app resources (Visual Studio for Mac)](/visualstudio/mac/managing-app-resources).
30-
3128
For more information about resources in .NET apps, see [Resources in .NET apps](/dotnet/framework/resources/index).
3229

3330
## Work with resources
@@ -40,6 +37,67 @@ In a managed code project, open the project properties window. You can open the
4037

4138
Select the **Resources** tab. You can add a *.resx* file if your project does not contain one already, add and delete different kinds of resources, and modify existing resources.
4239

40+
:::moniker range=">=vs-2022"
41+
## Resource Explorer improvements in Visual Studio 2022 and later
42+
43+
Starting with Visual Studio 2022 version 17.11, the resources explorer has been significantly improved. See [Introducing the Revamped Visual Studio Resource Explorer](https://devblogs.microsoft.com/visualstudio/introducing-the-revamped-visual-studio-resource-explorer/).
44+
45+
To use the new Resource Explorer, you need to have a .NET project that contains one or more resource files (`.resx`). To open the Resource Explorer, right-click on any resource file in the Solution Explorer and select **Open With** > **Resource Explorer**. Alternatively, you can use the keyboard shortcut **Ctrl**+**Alt**+**R**.
46+
47+
When you open the new Resource Explorer, on the left side, you see an overview of all the resources you’ve stored alongside the locales for each file. You can configure which locales are visible in the datagrid. This interface allows you to compare translations side-by-side and edit them in place.
48+
49+
:::image type="content" alt-text="Screenshot of the grid view of resources." source="media/vs-2022/resources-explorer/grid-view.png" lightbox="media/vs-2022/resources-explorer/grid-view.png":::
50+
51+
## Search for resource strings
52+
53+
At the top left of the grid, you can use the search box to do a text of search all your resource files. To search for a resource, type in the search box on the toolbar and press Enter. The data grid will show only the resources that match your query in their name, value, or comment. You can use wildcards (`*`) to perform partial matches, and quotation marks (`"`) to perform exact matches.
54+
55+
### Add comments to specific translations of a resource
56+
57+
Comments are a useful way to provide more information or context for a resource, such as the meaning, usage, or tone of a string. In the Resource Explorer, you can add comments to each translation of a resource and view them all at once in the data grid.
58+
59+
To add a comment to a resource, select the cell that corresponds to the translation you want to comment on, and click on the **Edit Comment** button on the toolbar, or press **Shift**+**Enter**. A comment box appears below the cell, where you can type in your comment. Press **Enter** to save the comment, or **Esc** to discard it.
60+
61+
You can edit or delete existing comments by clicking on the comment box or using the same keyboard shortcut. To view all the comments for a resource, look for the small triangle icon in the corner of each cell that has a comment. You can hover over the icon to see a tooltip with the comment text or click on it to open the comment box.
62+
63+
Comments are available to multiple users of the resource files. The translator, a developer, or a resource manager can leave notes, questions, explanations, or caveats alongside the translations. A small icon in the corner of each cell indicates the presence of a comment.
64+
65+
:::image type="content" alt-text="Screenshot of the comment UI in Resources Explorer." source="media/vs-2022/resources-explorer/comment-ui.png" lightbox="media/vs-2022/resources-explorer/comment-ui.png":::
66+
67+
### Filter resources
68+
69+
To filter resources, click on the filter icon on the toolbar and select the criteria you want to apply. You can filter resources by name, value, comment, type, or file.
70+
71+
| Filter | Description |
72+
| - | - |
73+
| Name | Show only the resources that have a certain name or prefix. |
74+
| Value | Show only the resources that have a certain value or contain a certain string. |
75+
| Comment | Show only the resources that have a comment or contain a certain string in their comment. |
76+
| Type | Show only the resources that have a certain type, such as string, image, or icon. |
77+
| File | Show only the resources that belong to a certain file or culture. |
78+
79+
You can combine multiple filters to narrow down your results and clear them by clicking on the Clear Filter button.
80+
81+
### Validation and warnings
82+
83+
Placeholders are special tokens that are replaced by dynamic values at runtime, such as `{0}`, `{1}`, or `{name}`. If you use placeholders in your resources, you need to make sure they are consistent across all localizations, otherwise you might see errors or unexpected behavior in your app.
84+
85+
The new Resource Explorer automatically validates placeholders for each resource and shows a warning icon if there is a mismatch between the default culture and any other localization. For example, if the default value of a resource is "Hello, {name}!" and the Spanish value is "Hola, {nombre}!", you'll see a warning icon showing that the placeholder name is different. You can hover over the icon to see a tooltip with the details of the mismatch and click on it to fix it.
86+
87+
Missing translations are another common issue that can affect the user experience of your app. If you don't provide a translation for a resource in a certain culture, the app will fall back to the default culture, which might not be proper or desirable for some users. The Resource Explorer helps you avoid this problem by showing a warning icon if there is no value for a resource in a certain culture. For example, if> you have a resource with a default value of `File` and no value for the French culture, you'll see a warning icon showing that the translation is missing. You can hover over the icon to see a tooltip with the message **No value** and select it to add a value.
88+
89+
:::image type="content" alt-text="Screenshot of the Resources Explorer when a missing translation is detected." source="media/vs-2022/resources-explorer/missing-translation.png" lightbox="media/vs-2022/resources-explorer/missing-translation.png":::
90+
91+
### Customization options
92+
93+
The Resource Explorer in Visual Studio 2022 and later is compatible with screen readers and assistive technology, to make it more accessible for developers with visual impairments or disabilities. You can use keyboard shortcuts to navigate through the data grid, edit values and comments, and perform common actions. You can also use the narrator to read each cell's contents, as well as the tooltips and warnings.
94+
95+
To adjust the zoom level, use the zoom slider on the toolbar, or the keyboard shortcuts **Ctrl**+**=** and **Ctrl**+**-**, to zoom in or out. Use **Ctrl**+**0** to reset the zoom level to default.
96+
97+
The theme for the Resource Explorer is consistent with the rest of the Visual Studio environment. You can choose between light, dark, or blue themes, and the Resource Explorer will adapt accordingly. You can also change the font and colors of the data grid, by using the **Tools** > **Options** > **Environment** > **Fonts and Colors dialog**.
98+
99+
:::moniker-end
100+
43101
## Resources in other project types
44102

45103
Resources are managed differently in .NET projects than in other project types. For more information about resources in:
Loading
Loading
Loading

0 commit comments

Comments
 (0)