all groups > dotnet internationalization > may 2006 >
You're in the

dotnet internationalization

group:

How to localize a property description using attributes?


How to localize a property description using attributes? Johnny
5/15/2006 4:13:02 PM
dotnet internationalization:
I am building a server control (web part) with localization support and I am
trying to find out how I can use a resource string for the Description
attribute of a property.

My control's properties look something like the code below. I've tried using
a resource string inside the Description attribute but receive a "An
attribute argument must be a constant expression" error message.

[Description("The height (in pixels) of the xxxx.")]
[Bindable(true), Browsable(true), Category("My Category")]
public int Height
{
get {}
set {}
}


Does anyone have any ideas or recommendations?

Re: How to localize a property description using attributes? Clive Dixon
5/16/2006 12:00:00 AM
Derive a class from DescriptionAttribute and override the virtual
Description property to do your resource lookup. Also look at the MSDN docs
for the DescriptionAttribute.DescriptionValue property which can be used to
store the string after first lookup.

--
======================
Clive Dixon
Digita Ltd. (www.digita.com)


[quoted text, click to view]

AddThis Social Bookmark Button