0ccbef45a1
Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1018 B
C#
35 lines
1018 B
C#
using System;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using atakanozbancom;
|
|
|
|
namespace atakanozbancom.Controllers
|
|
{
|
|
public class languageController : Controller
|
|
{
|
|
protected override IAsyncResult BeginExecuteCore(AsyncCallback callback, object state)
|
|
{
|
|
string lang = null;
|
|
|
|
HttpCookie langCookie = Request.Cookies["culture"];
|
|
if (langCookie != null && !string.IsNullOrWhiteSpace(langCookie.Value))
|
|
{
|
|
lang = langCookie.Value;
|
|
}
|
|
else
|
|
{
|
|
var userLang = Request.UserLanguages != null && Request.UserLanguages.Length > 0
|
|
? Request.UserLanguages[0]
|
|
: null;
|
|
|
|
lang = string.IsNullOrWhiteSpace(userLang)
|
|
? LanguageTR.GetDefaultLanguage()
|
|
: userLang;
|
|
}
|
|
|
|
new LanguageTR().SetLanguage(lang);
|
|
return base.BeginExecuteCore(callback, state);
|
|
}
|
|
}
|
|
}
|