<a href="/lang.php?lang=en">En</a>
lang.php:
$lang = $_GET['lang'];
$_SESSION['lang'] = $lang;
header('Location: /'.$lang);
index.php:
if(!isset($_SESSION['lang']) {
$_SESSION['lang'] = 'ru';
}
if(isset($_SESSION['lang']) && $_SESSION['lang'] == 'en') {
header('Location: /en');
}
<div class="preloader">Loading</div>
.preloader {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: #000;
color: #fff;
z-index: 9999999;
}
$(document).ready(function() {
$('.preloader').fadeOut();
});
// либо
$(window).on('load', function () {
$('.preloader').fadeOut();
});
if(isset($_SESSION['lang'])) { include('/langs/'.$_SESSION['lang'].'.php'); }
<a href="/lang.php?lang=en">En</a>
<a href="/lang.php?lang=pl">Pl</a>
<p><?= $lang['hello'] ?>, <?= $user->username ?></p>
if(isset($_GET['lang'])) {
$_SESSION['lang'] = $_GET['lang'];
}