Regionalisation of attributes?

  • Thread starter Thread starter Merrion
  • Start date Start date
M

Merrion

I have an attribute Description applied to the public interface items
of my usercontrol so that the developer knows what each property is
for e.g.:

'------------------------------------------------------------------------
<Description("Sets the spooler pooling interval"> _
Public Property Timeslice As Integer
'...
End Property

'------------------------------------------------------------------------

How do I make it so that the description will appear in French on a
French developer's machine etc.?

Thanks in advance,
Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
 
Merrion,
I wish I had the link handy, I remember an example someplace. :-(

You need to define your own DescriptionAttribute (inheriting from
DescriptionAttribute) and override the Description property. In your
overridden property you would localize the DescriptionValue field.

The only thing I am finding right now is the description of the
DescriptionValue property:
http://msdn.microsoft.com/library/d...iptionAttributeClassDescriptionValueTopic.asp

Something along the lines of the DescriptionLocalizableAttribute found in
the Microsoft Content Management Server 2002.
http://msdn.microsoft.com/library/d...descriptionlocalizableattributeclasstopic.asp

Hope this helps
Jay
 
Thatnks - inheriting from DescriptionAttribute worked. Ironic that
the word Localizable should itself need Locali(s/z)ing.

Have done the same for CategoryAttribute and overriden
"GetLocalizedString" as per the documentation...but is it possible for
an attribute to get the type name of the thing it is applied to? The
reason being that the resourcemanager that returns the description and
category attribute needs to know which component type it is being
called to return the localised string for.

Thanks in advance,
Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
 
Merrion,
Add a parameter to your derived class's constructor that is the type that
the Attribute is being applied to. Similar to the DefaultValueAttribute.

MyDescriptionAttribute(Type,String)

Hope this helps
Jay

Merrion said:
Thatnks - inheriting from DescriptionAttribute worked. Ironic that
the word Localizable should itself need Locali(s/z)ing.

Have done the same for CategoryAttribute and overriden
"GetLocalizedString" as per the documentation...but is it possible for
an attribute to get the type name of the thing it is applied to? The
reason being that the resourcemanager that returns the description and
category attribute needs to know which component type it is being
called to return the localised string for.

Thanks in advance,
Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com

"Jay B. Harlow [MVP - Outlook]" <[email protected]> wrote in
message news: said:
Merrion,
I wish I had the link handy, I remember an example someplace. :-(

You need to define your own DescriptionAttribute (inheriting from
DescriptionAttribute) and override the Description property. In your
overridden property you would localize the DescriptionValue field.

The only thing I am finding right now is the description of the
DescriptionValue property:
http://msdn.microsoft.com/library/d...iptionAttributeClassDescriptionValueTopic.asp

Something along the lines of the DescriptionLocalizableAttribute found in
the Microsoft Content Management Server 2002.
http://msdn.microsoft.com/library/d...descriptionlocalizableattributeclasstopic.asp

Hope this helps
Jay
 
Back
Top