I was trying to be witty and use a VirtualPathProvider to find localized views. It takes the requested view path and modifies it when checking after the file. It returns a localized virtual file if found:

```
public pseudoclass MyFileProvider : VirtualPathProvider
{

    bool FileExists(string requestedPath)
    {
        if (IsLocalizedView(requestedPath))
          return true;
       return base.FileExists(requestedPath);
    }

    bool IsLocalizedView(string requestedPath)
    {
        var uri = requestedUri.AddLocaleByMagic("sv");
        if (FileExistsInternal(uri))
          return true;
    }

    //some more stuff to return the actual file
}

```

The problem is that I get the following exception:

> 
> The VirtualPathProvider returned a VirtualFile object with VirtualPath set to '/Views/Shared/\_Layout.sv.cshtml' instead of the expected '/Views/Shared/\_Layout.cshtml'.
> 
> 
> 

Sure, I could fake the file path, but that would produce problems with caching and different localizations. Right?

Anyone got a better way to be able to create localized views? I do not want to use the same view but with resource strings instead. Such views are so horrible that they almost makes me cry because they are so hard to read.

If you still haven't understood what I'm looking for:

***/Views/User/Details.sv.cshtml***

```
Hejsan @Model.FirstName

Detta är en lite rolig text på svenska.

```

***/Views/User/Details.en.cshtml***

```
Hello @Model.FirstName

This is a test on english.

```

***Controller***

```
public ActionResult Details()
{
  return View(new User()); //should automagically use a swedish or english view
}

```

I want to be able to switch views (to a localized one using CurrentCulture) without having to do anything manually at each request.