Let's say I want to show a fieldset that contains a form and a button.
There will be some textboxes for I/O values and some labels for:
- the fieldset title (not related to values)
- textboxes (labels and validations)
- the submit button (not related to values)
The labels will be provided from a database based on localization.
For case 2 I would like to use the mechanisms for which mvc already has support (DataAnnotations attributes) so I have found the following 2 solutions:
- write a database resource-provider to use with DataAnnotations attributes (http://msdn.microsoft.com/en-us/library/aa905797.aspx#exaspnet20rpm_topic4)
- extend DataAnnotations attributes to use my database context and retrieve the localized text (asp.net mvc input / model validation multi language)
A view model example would be something like this:
Model
{
fieldset title localized label
[textbox localized display label]
[textbox localized validation label]
textbox value
button localized label
}
While the labels for case 2 are specified as meta-data for the view model values, what would be an elegant and consistent way for specifying localized texts from a database for case 1 and 3 considering a view with a big content?