Updates
This page contains a list of updates to the book. Also see the
Errata page for a list of typos.
Chapter 3, An Introduction To Internationalization
In this chapter I mention Strongly Typed Resources and also that ResGen has a "publicClass"
switch to allow you to generate public resources. Visual Studio 2008 introduces
a PublicResXFileCodeGenerator to complement the existing ResXFileCodeGenerator to
allow you to generate public strongly typed resource classes without having to use
ResGen. For more details see this
Public Strongly Typed Resources With PublicResXFileCodeGenerator.
Chapter 4, Windows Forms Specifics
One Windows Forms control that often pops up in localization discussions is the
MaskedTextBox control and specifically its Mask property and how to localize it.
The MaskedTextBox, its Mask property and Visual Studio's localized property editor
for the Mask property are covered in a blog entry entitled
Localizing MaskedTextBox Masks.
For a code snippet that preserves comments in Windows Forms resx files when Visual
Studio overwrites them see a blog post entitled
Preserving Windows Forms resx Comments.
In the section entitled "Deploying All Cultures Individually Using msbuild" on deploying
internationalized ClickOnce applications I mention the problem that setting the
PublishState of individual cultures is awkward in an automated build because the
PublishState is part of the .csproj or .vbproj file and there is no built-in way
of changing this setting. I suggest that you could write a utility for that purpose
and this is what I have now done. You can read more about it at
Setting The ClickOnce PublishState In Internationalized Applications.
Chapter 5, ASP.NET Specifics
The section entitled "Localizing ASP.NET 2 Components" mentions that the new System.Web controls such as the Login controls have a large amount of localizable text associated with them that is made localizable by selecting Tools | Generate Local Resources. The
downloadable source code for the book
now includes a utility called the ASP.NET Control Localizer that reads these localized resources from the .NET Framework Language Pack and automatically localizes these controls for you. The benefit is considerably less work for your localizer/translator.
Since the book was published Microsoft released ASP.NET AJAX which adds a new set
of localization and globalization considerations to the developer's world. I wrote
an article on this subject for the January 2008 issue of MSDN Magazine entitled
Around the World with ASP.NET AJAX Applications
that you can download. In addition you can
find the slides for a presentation that I gave on "Internationalizing ASP.NET AJAX"
at
http://www.guysmithferrier.com/downloads/i18najax.pdf.
The WebResource and ScriptResource HTTP Handler references (i.e. "script src=/WebResource.axd?...")
that are embedded in generated pages can be difficult to understand and difficult
to debug. For this reason I wrote a utility called the Script Resource Viewer that
you can download from the
Downloads
page. You can find an explanation for how to use it complete with screen shots at
http://www.guysmithferrier.com/details.aspx?Entry=143.
Visual Studio 2008 has a minor and important update to Tools | Generate Local Resources
in that it only adds culture and uiculture page attributes the first time it is
run. This can be important depending on your scenario. For a fuller explanation
see
http://www.guysmithferrier.com/details.aspx?Entry=213.
Chapter 6, Globalization
The Globalization chapter discusses how the IFormatProvider
helps to display numbers and currency in a given culture. However, there is no built
in solution for displaying currencies other than your own in your own culture's
format. See
Displaying Currencies In Your Local Format
for a solution to this problem.
In the section entitled "Setting The Keyboard
Layout Programmatically" a custom method called SetInputLanguage is written to show
how to set the input language to a setting appropriate to a culture (typically CurrentUICulture).
The code in the example is correct but the example itself is unnecessary as the
.NET Framework 1.1 and 2.0 already support this feature. Use InputLanguage.FromCulture
to achieve the same effect:-
InputLanguage.CurrentInputLanguage
= InputLanguage.FromCulture(CultureInfo.CurrentUICulture);
In the section entitled "Extending The CultureInfo Class"
the example shows how to add a property called PostalCodeInfo. You can get a list
of postal code formats and other formats that can be used with the MaskedTextBox's
Mask property in a blog entry entitled
Localizing MaskedTextBox Masks.
In the section entitled "Extending The CultureInfo Class" I show how to extend the
CultureInfo class by inheriting from it and fixing up the Parent and InvariantCulture
properties. This method is suitable for all versions of the .NET Framework. However,
with the advent of LINQ there is now an alternative to inheritance: Extension Methods.
Read
Extending The CultureInfo Class Using Extension Methods
and
Extension Methods In The .NET Framework 2.0
for more details. You can also watch a related micro-presentation (6 minutes 40
seconds) I gave on
Extension Methods Will Save The World.
Chapter 7, Middle East and East Asian Cultures
Microsoft has released a library of classes for East Asian cultures that add a number
of new features including number formatting and translation between Simplified Chinese
and Traditional Chinese. You can learn more about this
here.
Chapter 11, Custom Cultures
Several examples of custom cultures in this chapter show how to specify the calendar
class for a custom culture. However, the combination of using a custom calendar
with a custom culture is covered in a blog entry entitled
Why Can’t I Use My Own Calendar Classes In Custom Cultures ?.
One of the examples in this chapter shows how to export cultures from newer operating
systems to older operating systems. Unfortunately this is problematic when exporting
cultures from Vista. A blog entry entitled
Custom Cultures, Vista and the IetfLanguageTag
explains why and how the updated
downloadable source code for the book solves this problem.
Chapter 12, Custom Resource Managers
The section entitled "Using Custom Resource Managers in Windows Forms" introduces
a component called the ResourceManagerSetter (included with the source code for
the book). The ResourceManagerSetter injects the following line into the serialized
code for the form:-
resources = Internationalization.Resources.ResourceManagerProvider.GetResourceManager(typeof(Form1));
The purpose is to allow a form to draw resources from a resource manager other than
ResourceManager.
This code works fine for Visual Studio 2003. It used to work for Visual Studio 2005
and simply produce a warning. The section states that the warning can be ignored.
Unfortunately it cannot be ignored for the RTM release of Visual Studio 2005. The
updated ResourceMangerSetter for Visual Studio 2005 (available in the downloadable
source for the book) now injects a slightly different line into the serialized code
for the form:-
Internationalization.Resources.ResourceManagerProvider.GetResourceManager(typeof(Form1),
out resources);
This code does not raise a warning in Visual Studio 2005
and achieves the desired effect of setting the local resources variable to the ResourceManager
returned from GetResourceManager.
Chapter 13, Testing Internationalization Using FxCop
The section entitled "FxCop and ASP.NET" notes
that when Visual Studio 2005 was released the Web Application Project had been removed
and replaced with the Web Site Project. One of the consequences of this is that
the web site's assembly is generated in a pseudo random location and this makes
analysis by FxCop difficult (although the chapter suggests ways of overcoming this).
With the release of Visual Studio 2005 Service Pack 1, however, the Web Application
Project has been reintroduced and this represents an excellent solution for analyzing
web applications using FxCop.
The section entitled "FxCop and ASP.NET" discusses the fact that FxCop 1.35 ignores
generated code (and therefore code that originates from .aspx files). Starting with
FxCop 1.36 this behaviour has changed and FxCop now analyzes generated code by default
(to turn this feature off you check the "Suppress analysis results against generated
code" checkbox in the "Spelling & Analysis" tab of FxCop's Project | Options
dialog).
For a complete video presentation on Writing Custom FxCop Rules you can download
a presentation I gave at the annual VBUG Conference in 2006
here
.
Although Microsoft has still not released
any documentation for the FxCop SDK Jason Kresowaty has. You can get full details
here.
Appendix A, New Internationalization Features
in the .NET Framework 2.0 and Visual Studio 2005
A new utility, ConvertResX, has been added to the Visual Studio 2005 downloadable source code for the book.
ConvertResX converts .NET Framework 2.0 .resx files to .NET Framework 1.1 .resx
files. This utility is intended for projects that are created using Visual Studio
2005 but for whatever reason must be opened and compiled using Visual Studio 2003.
Appendix B, Information Resources
Add to the section entitled "Web Sites and FTP Sites" the following resources:-
-
Kwintessential,
http://www.kwintessential.co.uk,
country profiles, free online translator and culture test.
-
My Fonts International,
http://www.myfonts.com/International,
a source of international fonts.
-
Identifont,
http://www.identifont.com/,
a huge directory of fonts and font information.
-
Localization Directory,
http://www.theverybestofstuff.de/localization/localizationlinks.htm,
a directory of useful links for localization information.
-
Omniglot,
http://www.omniglot.com,
writing systems and languages of the world
The section entitled "Alternatives to .NET Framework Internationalization" mentions that Microsoft began work on a product called the Microsoft Application Translator in May 2004 but didn't release it. The idea behind this product is that it translates Windows applications on the fly by intercepting Windows before they are displayed and retrieving localized text from an updatable store. This approach has now been realized by the
WizTom product range
in the form of
WizTom For Windows
and
WizTom For .NET.
If you are interested in translating Windows applications on the fly take a look
at the
Microsoft Captions Language Interface Pack.