Jaex
Jaex

Reputation: 4304

In Visual Studio is there a way to automatically add all resx language files to projects?

In my C# project have multi language support using resx files. People do translation using external software and then doing pull request those resx files.

So I'm wondering is there a way to add those resx language files to projects automatically?

Example pull request: https://github.com/ShareX/ShareX/pull/437 and have 58 resx files there for French and I need to add those to projects manually now.

Upvotes: 3

Views: 1504

Answers (1)

Daniel Rose
Daniel Rose

Reputation: 17648

You can manually edit the projects files to include all resx files using wildcards, ex.

<EmbeddedResource Include="**\*.resx" />

That way, you just need to add the files to the project's directory (or any subdirectory).

Note that you will need to unload/load the project in Visual Studio (if currently is opened) when adding new files before the new files get noticed by Visual Studio.

EDIT: Since you want the resx files to be grouped with the Forms - which is done in MsBuild via the DependentUpon parameter - you will need to do the following for each form:

<EmbeddedResource Include="MainForm*.resx">
  <DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>

Upvotes: 3

Related Questions