I’ve been working on a typical implementation of Asp.Net MVC localization. However, unlike the textbook examples, I wanted to have just the language, not the culture, feature in my paths. Specifically, intead of writing http://mydomain.com/en-US/ I wanted to be able to write just http://mydomain.com/en/. Unfortunately, you cannot set the CurrentCulture variable to a ‘neurtal’ culture. Consequently, what I ended up doing is keeping a dictionary of cultures and applying the default one whenever needed:

public class InternationalizationAttribute :
  ActionFilterAttribute
{
  private static Dictionary<stringstring> cultureMappings =
    new Dictionary<stringstring>
      {
        {"en""US"},
        {"sv""SE"},
        {"ru""RU"}
      };
  public override void OnActionExecuting(ActionExecutingContext
                                           filterContext)
  {
    string language = (string)filterContext.RouteData.Values["language"] ?? "en";
    string culture = cultureMappings[language];
    try
    {
      Thread.CurrentThread.CurrentCulture =
        CultureInfo.GetCultureInfo(language + "-" + culture);
      Thread.CurrentThread.CurrentUICulture =
        CultureInfo.GetCultureInfo(language + "-" + culture);
    } catch
    {
    }
  }
}

I don’t know, though, maybe there’s a better way of doing this.