concept resource file in category .net

This is an excerpt from Manning's book .NET Core in Action.
Next, you’ll need to modify ACController.csproj to generate a resource file from the strings.restext file and embed it into the ACController assembly. Modify the csproj file as follows.
Listing 10.4. Generate a resource file from strings.restext and embed it
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="BuildResources"> #1 <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp2.0</TargetFramework> </PropertyGroup> <ItemGroup> <Resx Include="strings.restext" /> #2 <EmbeddedResource Include="strings.resources" /> #3 </ItemGroup> <Target Name="BuildResources"> #4 <GenerateResource ExecuteAsTool="false" #5 Sources="@(Resx)"> </GenerateResource> </Target> </Project>The ResourceManager class isn’t able to read the restext file directly. It only reads files in the binary .resources format. To convert the restext file into a resources file, a MSBuild task called GenerateResource is built into .NET Core. This task will read the set of files you give it and write out a resources file with the same name as the input file.
The resources file then needs to be embedded into the assembly so ResourceManager can find it. That’s why you add the EmbeddedResource ItemGroup. Note that the strings.resources file has to exist on disk during build. The easiest way to guarantee this is to create a custom target and add it to the InitialTargets list. This will cause the resource to be generated before the build begins (also before restore begins).
You don’t need all the localized resources while you’re writing your code. The resource files are also independent enough that you can avoid giving the external translation company access to your source code by instead giving them only the resource files.
If you’re developing with the Microsoft localization extension library, you’ll be writing your default language resource strings as keys in the code. This means you don’t have to create a resource file for the default language during development. This can be detrimental, because if you want to have an external company work on translations, you’ll need to create a resource file for them by searching the code for every key string. I see this as another reason to create a dummy culture—doing so forces developers to create and update resource files during development.
Context is also important when it comes to translation—the resources file doesn’t give the translator much context. You can help by adding comments to the restext file (use # at the beginning of the line), but sometimes it will take a bit more. You might decide to let the translator see the running application, but if it’s a specialized application, such as an MRI machine, this might not be enough. You basically need a translator who understands your business, or you’ll have to give them enough context to figure out the appropriate translations. Either way, don’t take localization lightly.