Lingobit Localizer - Software Localization ToolTools for software Localization DE | DA | FR | ES | IT | JA | NL | PL | PT | RU | TR | ZH
Software Localization

Lingobit Home > Lingobit Extractor
Lingobit Extractor

How to extract C# hard-coded strings from source code to resources

how to extract C# hard-coded strings to resourcesLingobit Extractor extracts hard-coded strings from C# 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


will be replaced with


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 C# project.

When you are using default resource file strongly typed resources can be accessed using the following template:


when you added a new ResX file, you can access resources using


Step by step

Here are the steps to extract hardcoded strings from C# source code and prepare your application for localization

  1. Create Extractor project
  2. Add source code files into the project
  3. Create ResX resource file in C# project if you don't have it.
  4. Add ResX file as resource into Extractor project
  5. Review hard-coded string list and select which strings should be extracted. Use Properties.$(RESNAME).$(ID) replace template for default resource file, and $(RESNAME).$(ID) for other files.
  6. Save all files
  7. Open Visual Studio and re-save resources. It will force it to generate strongly typed resource wrappers for new strings.