Using this answer, I created a sample localized app. My question is, is there some way to have Visual Studio automatically generated the strings.fr.resx file with the same strings (same names that is, with blank values), so someone who knows French can just fill them in, or do I actually have to manually create the resource for each language I want to support?
views:
173answers:
2
+3
Q:
Is there any way to automatically generate corresponding resx files for string localization in .NET?
A:
The only thing I know is to create the resource file manually and then go to the original resource file and copy the properties and values for the text resources to the newly created file. This also has the advantage that the translate knows exactly what she has to translate.
Obalix
2010-02-26 21:31:39
+2
A:
You can do this with a 3rd party tool: Zeta Resource Editor
- Once you open Zeta Resource Editor (ZRE), you have to create a new ZRE project.
- Then you have to add your
existing resource files into the
this project.
- To do this automatically for all resource files:
- Click on the "File Groups and tags" tab
- Click on "Automatically add multiple file groups to project" and follow the instructions.
- To do this automatically for all resource files:
- To add the new language:
- Highlight the appropriate node in the "Project files" tree.
- Click on the "File Groups and tags" tab
- Click on "Create new file" and follow the instructions.
- Make sure you include the newly created resex file into your Visual Studio project.
What's nice about using this tool is that you can also use it to export/import your translations to a spreadsheet for translations. (You can do this from the "Start" tab)
Alternatively, you could write your own small program to do this. The heart of the program is this:
using( ResXResourceReader reader = new ResXResourceReader( resourceFileName ) )
using( ResXResourceWriter writer = new ResXResourceWriter( newResourceFileName ) )
{
foreach( DictionaryEntry entry in reader )
{
writer.AddResource( entry.Key.ToString(), "" );
}
writer.Generate();
writer.Close();
}
Greg
2010-02-26 21:59:09
Awesome. Thanks.
Daniel Straight
2010-03-01 16:27:17