user20353
user20353

Reputation: 1303

How do I get all strings from a Form for localization?

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.

Upvotes: 0

Views: 707

Answers (2)

user20353
user20353

Reputation: 1303

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.

Upvotes: 0

Rob Prouse
Rob Prouse

Reputation: 22647

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.

Upvotes: 1

Related Questions