Localization (translation) using resource strings with MVC framework

 Published On

A very nice and complete post that I found in Alex’s blog. A few concerns though about what is written :

1/ I don’t believe there is need to write a custom attribute like (unless you want to enhance it)

public class LocalizedDisplayNameAttribute : DisplayNameAttribute{}

I preferred the following for my budget entry model since the base behaviour is OK for me :

[Display(Name = "Amount", ResourceType = typeof(Resources.Model.Budget.BudgetEntryStrings))]
public class Budget{}

2/ I think this might be good idea to create completely new project for resources. Like that, these resource files can be managed by an other team or an automatic way of updating them (via a WPF hard client application) for example can be found.

His article gives a handy start point! Thanks…

Tags:   .net   c#   data annotations   localization   mvc   resource strings


comments powered by Disqus
← Previous

© 2017 - Mechanical Object. All rights reserved
Built using Jekyll