+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Datasources with Data Annotations (.net) should be supported

Hey



You provide multilanguage support within List & Label and I know the sample.

But, I think a lot of localization is used country specific. What means that, when my software runs in germany, almost everyone will use german as language and does not want to switch to different language. Also, when using the software in France, they will need france text only.

For this, it would be fantastic, when the Object DataProvider could check, if the data depends on DataAnnotations and use the information of the given data.

In this case a localization could be done with easy



THX Harald

Hi Harald,

Thanks for the suggestion. Just to make sure I understood it correctly: usually, DataAnnotations are used for validations or data type constraints. If you’re thinking of using it for localization, you’re probably refering to the [Display(Name=…)] attribute? If that is the case, you could just use the DisplayNameAttribute from the System.ComponentModel namespace. However, I can’t see how this would help with dynamic localization as the attributes would be compiled statically. If you could shed some more light I’d be happy to check if we can implement an extension to the ObjectDataProvider.

Jochen

Hey
THX for your Feedback. - Sorry that I answer so late to your qurey, but I didn’t get informed, that there is a comment…
So, yes and no…
Here is a sample, how DisplayNameAttribute can be dynamic and not static:
http://blog.gauffin.org/2011/09/easy-model-and-validation-localization-in-asp-net-mvc3/
This is a similar aproach to my solution. And so, the names of the fields would get the correct visualised Name without extra coding.
THX Harald

Hi Harald,

Thanks for the clarification. I will dig a bit into that topic. However there might be an even better approach. If you localize on the data level already, you need to create a new project file for each language as the identifiers are not interchangable. I’d suggest to use List & Label’s localization layer instead. That way, your project file can remain the same while the desiger is localized for each language. See the “Localization” samples for C# and VB .NET for a starter.

I’ll still see if we can also support the DataAnnotations. Feel free to send me a small sample project that contains your approach, if you like. My contact details can be found at https://www.combit.net/en/about-us/#MeettheManagement.

Jochen

Hey
THX for your quick answer.
I know your samples about this aproach.
I don’t agree with you 100%… The Name (Key) of the Variable is still the same, does not mater how the Annoation present it on the Screen. So, this would make multiple Projects obsolete, because the underlying data is always the same. - But the displayed text is not.
THX

I see - the current approach for the DisplayName attribute is to change the actual name of the identifier (variable/field). Perfectly valid as it’s static, not dynamic.

So currently, a solution for you would be to parse your object model and pass the Annotations as dictionary entries. And I will see if that is something we could do as well.