0

I have my own implementation of Razor view engine that allows me to process partial views and views "feeding" so that I serve a localized versions of my views to the client.

I use protected override IView CreateView to override view selection process and inject language aware logic.

I also have protected override IView CreatePartialView but when I load a view that suppose to render my _Layout.cshtml CreatePartialView doesn't get firred up.

Which method of a ViewEngine I need to override to "catch" the _layout page rendering to perform a language-aware substitution?

Maxim V. Pavlov
  • 10,303
  • 17
  • 74
  • 174

1 Answers1

0

One way would be to specify an language-specific layout from a language-specific view via setting the Layout property like this:

@{
    Layout = "~/Views/Shared/_Layout.french.cshtml";
}

This is still not a good way, since it break an entire "view/language" linking paradigm, that relies of the view engine override code.

But it is more flexible because allows to move away from master view naming convention.

Maxim V. Pavlov
  • 10,303
  • 17
  • 74
  • 174