I am just looking at the doco on the web and the screencasts and the first question I need to ask is about Localization.
If you use the Metadata tags for example
public class Product_MD
{
[DisplayName("My units")]
[Description("This number shows how many unites are left")]
[Range(0, 150, ErrorMessage =
"Incorrect range for the units in stock")]
[UIHint("IntegerSlider")] public object UnitsInStock {
get; set; }
[UIHint("BooleanAjax")] public object Discontinued {
get; set; }
}
Can you localize as you would any asp.net app the MetaData tags eg. "My units" "This number shows how many unites are left" etc.
The apps we create usually need to adapt to different language depending on the user logged in.
The answer is slightly complex, because there is a distinction between the attributes that already existed and that we're using (DisplayName, Description), and the new attributes that we created for Dynamic Data (Range, ...).
The existing attributes don't have built in support for localization, but it can still be done through derivation: e.g. extend DisplayNameAttribute and override the DisplayName property to return a localized string.
The new attributes like Range have built-in localization support, via the ErrorMessageResourceName and ErrorMessageResourceType properties. I think the newest docs on
Code Gallery discuss this.
Sir,
could you give me some more information about multilingual project using dynamic data.
if possible please give me the same sample code.
I am new in this area.
sjariel
0 Points
1 Post
Localization and Meta data tags
Apr 11, 2008 07:16 AM|LINK
I am just looking at the doco on the web and the screencasts and the first question I need to ask is about Localization.
If you use the Metadata tags for example
public class Product_MD {
[DisplayName("My units")]
[Description("This number shows how many unites are left")]
[Range(0, 150, ErrorMessage = "Incorrect range for the units in stock")]
[UIHint("IntegerSlider")]
public object UnitsInStock { get; set; }
[UIHint("BooleanAjax")]
public object Discontinued { get; set; }
}
Can you localize as you would any asp.net app the MetaData tags eg. "My units" "This number shows how many unites are left" etc.
The apps we create usually need to adapt to different language depending on the user logged in.
I would appreciate anyones feedback.
davidebb
Contributor
7006 Points
1366 Posts
Microsoft
Re: Localization and Meta data tags
May 28, 2008 03:31 PM|LINK
The answer is slightly complex, because there is a distinction between the attributes that already existed and that we're using (DisplayName, Description), and the new attributes that we created for Dynamic Data (Range, ...).
The existing attributes don't have built in support for localization, but it can still be done through derivation: e.g. extend DisplayNameAttribute and override the DisplayName property to return a localized string.
The new attributes like Range have built-in localization support, via the ErrorMessageResourceName and ErrorMessageResourceType properties. I think the newest docs on Code Gallery discuss this.
David
akp_gst
Member
16 Points
8 Posts
Re: Localization and Meta data tags
Jun 13, 2008 04:19 AM|LINK
Sir,
could you give me some more information about multilingual project using dynamic data.
if possible please give me the same sample code.
I am new in this area.
Awadhesh(akp)