Microsoft .NET is a platform for building desktop, web and mobile applications.
Amanuens lets you easily and efficiently localize your applications that use standard .NET resource files (
.resx).
Amanuens Prerequisites
To translate your .NET application with Amanuens, you must first extract all strings and save them into
.resx files. Each
.resx file is a XML document that can contain several types of data. In this case, we must focus on strings.
Generating RESX Resource Files for Desktop Applications
If you're building a
desktop application with
Microsoft Visual Studio, you first have to enable support for the localization infrastructure. To do so, go to the
Properties Window of each Form in your project, and make sure that the
Localizable property is set to
true.
 A Form's Properties Window |
Visual Studio will automatically generate all the required
.resx files for each Form and each language. To enter the text in a language other than the default, simply select it from the appropriate drop-down, and edit the text directly in the Form editor.
 The Language Selection Drop-down Menu |
The .NET runtime will take care of loading the appropriate file based on the current user's locale.
Generating RESX Resource Files for Web Applications
If you're building a
ASP.NET application with Visual Studio, you can generate
.resx files automatically. To do so, open a web page in
Design mode.
 The Design Mode Selector |
From the
Tools menu, select
Generate Local Resource: Visual Studio will create a
App_LocalResources folder and all page-related
.resx files will be saved there. All controls in your page will get a reference to the resource file. Take
MyPage.aspx as an example:
<asp:Button ID="btnSave" runat="server" Text="Save" ToolTip="Save this document" meta:resourcekey="btnSaveResource1" />
MyPage.aspx.resx will contain several items for each control in the page (as shown by Visual Studio):
 Visual Studio .resx Editor |
To create a
.resx file for a new language, create a copy of the
Invariant Culture file created by Visual Studio (
MyPage.aspx.resx) and add the language code in its name, for example:
App_LocalResources/
MyPage.aspx.resx
MyPage.aspx.it-IT.resx
MyPage.aspx.fr-FR.resx
For a list of valid language codes, please refer to
this documentation. The .NET runtime will take care of loading the appropriate file based on the current user's locale.
Manually Generating RESX Resource Files
You can also create
.resx files manually. To do so, use Visual Studio to create a new
.resx file and start populating it with content. To make all strings easily accessible from code, make sure you specify that the
.resx files are compiled as
embedded resources.
As an example, assuming you placed
Strings.resx files in the
Properties directory of your solution, you can easily access embedded resource files from code with a statement similar to:
btnSave.Text = Properties.Strings.SaveText;
btnSave.ToolTip = Properties.Strings.SaveToolTip
The .NET runtime will take care of loading the appropriate file based on the current user's locale.
Windows Phone 7 (WP7) and Silverlight¶
Using
.resx files to localize Windows Phone 7 applications is a bit more complex because the XAML does not allow all the constructs found in the larger WPF. We have a
dedicated tutorial.
Silverlight works in a similar way, and
MSDN provides a good tutorial.
Managing Updates
When you add new strings to your application, make sure to update the
Invariant Culture resource file (e.g.
Strings.resx) so that Amanuens can detect the changes and propagate them to translated
.resx files.
Further Reading
To get more details about localization in .NET, please refer to the following articles:
Getting Started with Amanuens
Make sure all of your existing
.resx files are committed in your source code repository (Amanuens will generate missing files automatically). To start translating your application you can continue reading on how to
configure projects in Amanuens