I have a feeling this is something very obvious that I'm missing, but here goes.
I'm trying to set up multiple languages in an ASP.Net MVC project (C#, MVC2, .Net4.0). However, I have some cases where I want to have phrases translated within the Controller (error/success messages, mostly). However, it seems every method I try is either protected
or internal
. How do I access the resx
files from within my Controller?
This is a presentation specific concern, I think the best approach is to handle this at a View level. You will have less problems if you access resources from the View. Also note that accessing resources from the controllers make them less testable, because when accessing a resource (by default) the resource manager looks for a specific file which is not found when you´re testing.