a .Net SDK tool that localization specialists can use to localize Forms. It hosts
designers for the Form and components on it, and also a property grid, using which
you can localize a Form and save it to the appropriate culture. The MSDN link above
has general information about how to use this tool.
The cool thing about WinRes is that it can visually represent a Form based on just
the information contained in a resource file (.resx or .resources). It can bring up
a Form at design time and allow you to modify its localizable properties - all without
access to the source code. How does it do that? The resource file has information
in it about the Type of the components present on a Form. WinRes uses this information
to dynamically create those components and their designers. It then initializes the
(Localizable) properties on those components using the values serialized (I will probably
talk another day about how we do the serialization) into the resource file by Visual
Studio. Once the localizer has made the appropriate modifications, it serializes the
new set of property values into a culture specific resource file (like Form1.fr.resx
for French) that can be built into a satellite assembly. To learn more about Localization
in general, here are
some useful articles.
The ability to design and localize a Form visually without access to the source code
is nice, but there are currently some limitations to what WinRes can do. I have fielded
many questions about WinRes from both internal and external customers. I think documenting
the limitations of the WinRes and the common issues you might run into maybe of some
benefit. This blog is as good a place as any to do this, so here goes.
First of all, having a basic knowledge of the resource file format can be extremely
useful when you run into problems. Resource files can be either in XML (.resx) or
binary (.resources) format. The .resx format is more human-readable, so if you have
a .resources file that you wish to look at, use the ResGen tool
to convert it to a .resx. Now, open the .resx file in notepad. You will find the schema
definition and some other stuff in the header. That stuff is not so interesting, so
I won't describe it here. The rest of the .resx file is made up of "data" nodes. Each
data node represents one localizable property in the dialog. Lets look at a couple
of data nodes in a simple resx file for a Form that contains a Button:
<data name="button1.Size" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0,
The first node has the name "button1.Size", so looks like it represents the Size property
of a component called button1. The type attribute represents, not surprisingly, the
full name of the Type of this property. The value node contains a string representation
of value of the Size property, which is in this case: (Width = 75, Height = 23). SImilarly,
the second node above represents the Text property on button1. There is no Type information,
so by default, this means that the property is of type String.
Okay, but what is button1? This information is conveyed by the following "special"
properties, prefixed with the ">>":
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
These are special because they convey information about what button1 represents. The
Type property tells us that button1 is actually a Windows Forms Button control. Its
parent is "$this", which represents the Form being localized. The ZOrder value helps
determine the order in which this component is placed on this Parent control relative
to its siblings. The Name, ofcourse, is the name assigned to this instance of the
Button control by the VS designer. With the above information, you should be able
to decipher most of the contents of the .resx file.
Okay, now we are ready to look at some of the possible reasons for getting a 'Red
X' (error) in WinRes when you load a Form. Unfortunately, the error messages that
WinRes displays are currently often cryptic. So, when an error occurs, you should
open the .resx file in notepad and take a look.
That is all I can think of at this time. I will post more information when I can.