0
我做了多語言網站。所有的工作都很棒。我把我的翻譯保存在.resx文件中。但驗證信息僅在一個語言中顯示。 我的代碼是Asp.net多語言網站驗證
public class CultureAttribute : FilterAttribute, IActionFilter
{
public void OnActionExecuted(ActionExecutedContext filterContext)
{
string cultureName = null;
// Получаем куки из контекста, которые могут содержать установленную культуру
HttpCookie cultureCookie = filterContext.HttpContext.Request.Cookies["lang"];
if (cultureCookie != null)
cultureName = cultureCookie.Value;
else
cultureName = "ru";
// Список культур
List<string> cultures = new List<string>() { "ru", "en" };
if (!cultures.Contains(cultureName))
{
cultureName = "ru";
}
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cultureName);
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(cultureName);
}
public void OnActionExecuting(ActionExecutingContext filterContext)
{
//не реализован
}
}
請提供更多,像您的驗證消息顯示,您的驗證控件 – Jacky