Form Localization

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

Hi,

I have a set of forms in a windows application which I'd like to
localize. Some of these forms contain the same strings, for instance -
"are you sure?". I would like to put this string in one place which
will still be autoselected by the CLR relevant to current language and
culture but referenced by many forms.

Is this possible - to have a centralized string location, and if so,
where should the .resx files go?

Thanks
Matt
 
Have you seen the Localizable property in design time for forms?

Setting this to true will put the skeleton of this into place for you and
you can add to the auto-generated resx files for your own strings etc.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
As long as the strings are all being used in the same assembly, they can be
referenced by code in multiple forms.

If the strings are being entered directly in the UI designer, I think you
will be stuck with duplicated strings. There are tools on the market for
translation that will look for dup strings and update them all (by you
entering one translation).

As Bob mentioned, look at the form properties, and turn on the localize
property.
Good Luck.
 
Hi Bob,

Yes I've seen that property although the problem is that auto-
generates a resx file per form. The problem Im having is that some of
my forms share strings so I need somewhere centralized where the
string can be put once and used by many forms. I need this then
central resouce file to be swapped in and out by the CLR depending on
culture as per the usual .net behaviour.

For instance I have 2 forms, each has the text 'View Details' on them,
they are not inherited and I don't want them to be. So, would it be
possible to have 1 resource file for each culture which contains the
text 'View Details' and to associate both forms view details button
text with that global resource file?

Thanks
Matt
 
As Kenneth pointed out, the usual approach is to have independent
resources for each form/control and then use a seperate tool to manage
the translation of duplicates. The advantage of this approach is
that it allows you the flexibility when doing a translation for a new
language to translate strings that may have the same invariant
(usually English) text to different text depending on the context.
You should not assume that just because the text for two buttons in
two separate forms is the same in English it will be translated to the
same text in all other languages. Sometimes the context can make a
difference. If you try to centralize the resources with the same
English translation you may save a little space but you may be forced
to make code changes later when localizing into a new language.

Infralution have a reasonably priced tool (Globalizer.NET) that can
automatically scan your projects/solutions for resources to translate
and combine them into a single workspace file that you can send to
your translator. It can automatically translate duplicated resources.
We provide a free translator version of the tool that you can give to
the translator. This allows the translator to translate, preview and
even compile and run the localized application - without having to
install and understand Visual Studio. You can get more information
and download an evaluation version from www.infralution.com/globalizer.html

Regards
Grant Frisken
Infralution
 
What you're describing would be covered under the topic of Satellite
Assemblies.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Back
Top