views:

252

answers:

2

All articles I've read about localization of a WinForms application assume that I already have all the strings translated. According to the articles, I should just set the Localizable property to true and edit all the controls.

But how do I get all the original (English) strings from the form? Assume I have a complete application, which wasn't localized so far. Should I somehow manually parse the strings from the Designer file or is there any other, simpler approach?

I need to send the strings to the translators in Excel or Word. Since the translators don't have any experience with resources, I will finally move all the translated strings back to my forms and change the controls' sizes, positions etc. where needed.

EDIT: thanks to Rob's answer and comments, the solution is first to set the Localizable property to true. Then, I can easily copy all strings from the resx files that belong to the forms.

+1  A: 

I you are doing localization the same way as I am, you just go into the Properties directory of your project and open the Resources.resx file in a text editor. In that, the strings are in XML nodes that look like this;

<data name="ErrorLaunching" xml:space="preserve">
  <value>Error launching Ivara</value>
  <comment>MessageBox text in LogonForm</comment>
</data>

Once you get them translated, they go into similarly named files like Resources.fr.resx for French.

You can also open Resources.resx in Visual Studio, select Strings and copy/paste into Excel.

Or, by your description, you might be doing localization on a per form basis. In that case, the above applies, except that it is the Resx file for your form that you are interested in.

Rob Prouse
A: 

Rob, in the Resources.resx file, I have only strings that I show manually in MessageBoxes etc. These strings can be copied to Excel without any problems.

But if I open the MyForm.resx that belongs to a form, this file is empty (in fact, all resx files of all forms are empty). How do I get to the strings table of my forms?

I use VS2008 if that makes any difference.

This should be a comment.All you should need to do is set the form to Localizable and save it. Then if you look in the designer, in the IntitializeComponent() method, you should see a line like this; resources.ApplyResources( this, "$this" ); If so, the Resx should have all your data in it.
Rob Prouse
I just did this with a simple test project in VS2008 Team System and it worked as expected.
Rob Prouse