HighTechTalks DotNet Forums  

How to localize a property description using attributes?

Dotnet Internationalization microsoft.public.dotnet.internationalization


Discuss How to localize a property description using attributes? in the Dotnet Internationalization forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Johnny
 
Posts: n/a

Default How to localize a property description using attributes? - 05-15-2006 , 07:13 PM






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?

- Johnny

Reply With Quote
  #2  
Old   
Clive Dixon
 
Posts: n/a

Default Re: How to localize a property description using attributes? - 05-16-2006 , 04:37 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)


"Johnny" <Johnny (AT) discussions (DOT) microsoft.com> wrote

Quote:
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?

- Johnny



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.