Localization in Classes

  • Thread starter Thread starter Pieter
  • Start date Start date
P

Pieter

Hi,

I'm using VB.NET with VS.NET 2005. I'm using the standard localization to
localize my Forms and UserControls, which works perfect.

BUT: I also want to localize the (error)messages I'm using in my CLASSES.
But there isn't a .resx file created for my classes. Is there any way to
generate somewhere such a set of files to be able to handle easily
localization inside classes? Or what is the best practice to do this?


Thanks a lot in advance,


Pieter
 
Dans : Pieter disait :
Hi,

I'm using VB.NET with VS.NET 2005. I'm using the standard
localization to localize my Forms and UserControls, which works
perfect.
BUT: I also want to localize the (error)messages I'm using in my
CLASSES. But there isn't a .resx file created for my classes. Is
there any way to generate somewhere such a set of files to be able to
handle easily localization inside classes? Or what is the best
practice to do this?

Try this.
Add a resource file to your project and give it the name of the file
containing your class (keeping the extension .resx).
Then VS will attach it to the class file and generate a designer file to
access the resources.
You can add several resource files, with the culture name before the
extension.

ex : MyClass.vb
Add MyClass.resx -> MyClass.designer.vb
Add MyClass.fr-BE.resx

You access the resources with My.Resources.MyClass.ResourceName
 
Back
Top