How to extract Visual Basic.NET hard-coded strings from source code to resources
Lingobit Extractor extracts hard-coded strings from Visual Basic.NET source code to ResX resources. Original string is replaced with a code that loads it from resources. By default Lingobit Extractor uses strongly typed resources to access resources. For example
Console.WriteLine("Hello!");
will be replaced with
Console.WriteLine(My.Resources.String1);
Strongly-typed resource wrappers are generated by Visual Studio. Therefore, after you extracted strings using Lingobit Extractor you need to open resources from Visual Studio and re-save them. It will force Visual Studio to generate strongly typed wrappers for new resources.
Working with ResX files
.NET applications usually use .ResX files to store resources. If you don't have such files in your project you can create it automatically using Visual Studio. Right-click the project, select Properties and go to Resources tab. It will ask you to create default resource file. You can also create new ResX file using Extractor and insert it into Visual Studio Visual Basic.NET project.
You can use the following extraction template to work with Visual Basic.NET resources
My.Resources.$(RESNAME).$(ID)
Step by step
Here are the steps to extract hardcoded strings from Visual Basic.NET source code and prepare your application for localization
- Create Extractor project
- Add source code files into the project
- Create ResX resource file in Visual Basic.NET project if you don't have it.
- Add ResX file as resource into Extractor project
- Review hard-coded string list and select which strings should be extracted. Use My.Resources.$(RESNAME).$(ID) replace template.
- Save all files
- Open Visual Studio and re-save resources. It will force it to generate strongly typed resource wrappers for new strings.
|