Globalization :The process of designing and developing that works across multiple cultures / locales.
Localization :The process of customizing a particular language. ie, which is easy to use in the target country.
Open your Global.asax and put this code
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies["Language"];
if (cookie != null && cookie.Value != null)
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cookie.Value);
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(cookie.Value);
}
else
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en");
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
}
}
Open your controller and put this code
public ActionResult ChangeLanguage(string lan)
{
if (lan != null)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lan);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(lan);
var cookie = new HttpCookie("Language");
cookie.Value = lan;
Response.Cookies.Add(cookie);
}
return RedirectToAction("Index","Home");
}
This is your change language function..
open your view page and add this type of html code
<h1>Localization Demo Project</h1>
@Html.ActionLink("Local Language", "ChangeLanguage", "Home", new { selectedlanguage = "ne" }, new { @class = "btn btn-default" })
@Html.ActionLink("English Language", "ChangeLanguage", "Home", new { selectedlanguage = "en" }, new { @class = "btn btn-default" })
<div class="row">
<label>@LocalizationDemo.Language.Localization.First_name</label>
<br />
<label>@LocalizationDemo.Language.Localization.Last_name</label>
<br />
<label>@LocalizationDemo.Language.Localization.Address</label>
</div>
Fore more details Step by step Click this link
http://www.findandsolve.com/articles/localization-in-asp.net-mvc-razor-step-by-step