using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace HH.WMS.WebUI.LanService
{
///
/// 自定义viewPageBase
///
public abstract class ViewPageBase : ViewPageBase
{
}
///
/// Base class for all views in system.
///
/// Type of the View Model
public abstract class ViewPageBase : WebViewPage
{
///
/// Gets localized string for given key name and current language with formatting strings.
///
/// Key name
/// Localized string
protected virtual string L(string name)
{
var cookie = HttpContext.Current.Request.Cookies.Get("lanGroup");
string language = cookie == null ? "zh_CN" : cookie.Value;
string text = "";
var lanGroup = HttpRuntime.Cache.Get("lanGroup") as Dictionary>;
if (lanGroup != null && lanGroup.Keys.Contains(language))
{
Dictionary _lanGroup = lanGroup[language];
if (!string.IsNullOrEmpty(name) && _lanGroup.Keys.Contains(name))
{
text = _lanGroup[name];
}
}
return text;
}
///
/// Gets localized string for given key name and specified culture information.
///
/// Key name
/// culture information
/// Localized string
protected virtual string L(string name, string culture)
{
string language = culture;
string text = "";
var lanGroup = HttpRuntime.Cache.Get("lanGroup") as Dictionary>;
if (lanGroup != null && lanGroup.Keys.Contains(language))
{
Dictionary _lanGroup = lanGroup[language];
if (!string.IsNullOrEmpty(name) && _lanGroup.Keys.Contains(name))
{
text = _lanGroup[name];
}
}
return text;
}
}
}