Initial commit: open-source release of atakanozban.com
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user