NancyFx/Nancy — pull request #861 by jchannon (2012-12-13 09:36:25+00:00)
Title: Localisation with Razor

As the NancyContext hopefully now has Culture on it it would be useful for views to be able to output translations.

I have added ILocalisation to RazorViewBase and then in a View you can call @Localisation["Greeting"]

This then goes to the implementation whether that be Resx, Database etc to return the correct translation.

At present there is a DefaultLocalisation to show an example however I'm not sure whether we need to include this and just let users have an implementation that TinyIOC picks up automatically

Also added are a new set of ViewLocation conventions which are duplicates of the exisintg ones with culture tagged on but given higher priority.

For example

(viewName, model, viewLocationContext) => {
return string.Concat("views/", viewName, "-", viewLocationContext.Context.Culture);
},

(viewName, model, viewLocationContext) => {
return string.Concat("views/", viewName);
},

So in the Module you specify `return View["Index"]` and then based on the DefaultCultureConventions it determines the culture and then the view locator looks for "Index-en-GB" and if it doesnt find it, it looks for "Index"