15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

localization with asP.neT ❘ 591<br />

outsourcing Translations<br />

It is an easy task to outsource translations using resource files. It is not necessary to install Visual Studio to<br />

translate resource files; a simple XML editor will suffice. The disadvantage of using an XML editor is that<br />

there is no real chance to rearrange Windows Forms elements <strong>and</strong> change the sizes if the translated text does<br />

not fit into the original borders of a label or button. Using a Windows Forms Designer to do translations is a<br />

natural choice.<br />

Microsoft provides a tool as part of the .<strong>NET</strong> Framework SDK that fulfills all these requirements: the<br />

Windows Resource Localization Editor, winres.exe (see Figure 22-12). Users working with this tool do<br />

not need access to the <strong>C#</strong> source files; only binary or XML-based resource files are needed for translations.<br />

After these translations are completed, you can import the resource files to the Visual Studio project to build<br />

satellite assemblies.<br />

figure 22-12<br />

If you don’t want your translation bureau to change the sizes <strong>and</strong> locations of labels <strong>and</strong> buttons, <strong>and</strong> they<br />

cannot deal with XML files, you can send a simple text-based file. With the comm<strong>and</strong>-line utility resgen<br />

.exe, you can create a text file from an XML file:<br />

resgen myresource.resX myresource.txt<br />

And after you have received the translation from the translation bureau, you can create an XML file from<br />

the returned text file. Remember to add the culture name to the filename:<br />

resgen myresource.es.txt myresource.es.resX<br />

loCalizaTion WiTh asP.neT<br />

With ASP.<strong>NET</strong> applications, localization happens in a similar way to Windows applications. Chapter<br />

40, “Core ASP.<strong>NET</strong>,” discusses the functionality of ASP.<strong>NET</strong> applications; this section discusses the<br />

localization issues of ASP.<strong>NET</strong> applications. ASP.<strong>NET</strong> 4 <strong>and</strong> Visual Studio 2010 have many features to<br />

support localization. The basic concepts of localization <strong>and</strong> globalization are the same as discussed before.<br />

However, some specific issues are associated with ASP.<strong>NET</strong>.<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!