我有两个项目的解决方案,资源和主项目。
我将resource.dll和文件夹添加到主项目。但是当我改变文化时,它将获得默认资源。
public class LanguageController : Controller
{
// GET: Language
public ActionResult Change(string lan, string url)
{
if (lan != null)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lan);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(lan);
}
HttpCookie cookie = new HttpCookie("language");
cookie.Value = lan;
Response.Cookies.Add(cookie);
return Redirect(url);
}
}