atakanozbancom/Controllers/languageController.cs
Atakan Doğan Özban 0ccbef45a1 Initial commit: open-source release of atakanozban.com
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 13:29:09 +02:00

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);
}
}
}