Files
LeafWeb/Web/Utility/LocalizationHelper.cs
T
2016-01-13 21:56:22 -05:00

25 lines
842 B
C#

using System;
using System.Threading;
using System.Web;
using System.Web.Mvc;
namespace LeafWeb.Web.Utility
{
public static class LocalizationHelper
{
[Obsolete("specifying the language through <meta http-equiv=\"content-language\" content= > is obsolete. Use <html lang=> instead")]
public static IHtmlString MetaContentLanguage(this HtmlHelper html)
{
var acceptLang = HttpUtility.HtmlAttributeEncode(Thread.CurrentThread.CurrentUICulture.ToString());
return new HtmlString(string.Format("<meta http-equiv=\"content-language\" content=\"{0}\"/>", acceptLang));
}
public static string Lang
{
get
{
return HttpUtility.HtmlAttributeEncode(Thread.CurrentThread.CurrentUICulture.ToString());
}
}
}
}