views:

31

answers:

1

In my project every page is translatable in several languages. For that purpose, I pass a sitelanguage parameter to each action. My custom base controller class catches this "siteLanguage" parameter and takes care of the further translation logic.

This works allright, only thing is now I have to add a string called sitelanguage to every action procedure signature just so my base controller can catch it. I don't do anything with this parameter in my actual action logic.

Is there a better way of doing this?

+1  A: 

I'd put the site language in the session, and make the controller give it to the views, or maybe, just maybe, allow the views to retrieve it from there.

I'd suggest Culture and CurrentCulture etc, but of course those don't work if you are an English speaking person who logs on from France. I typically tie the language with the users' preferences in the database, though I appreciate your site may not require a logon as such.

Neil Barnwell