Multi Language Settings
Let's add the French language.
-
Create a new file fr.php in the fr folder in the
/assets/head-main.php
folder and copy theen.php
file code in this file. -
add this language array in layouts/head-main.php file code.
$langArray = ["fr"];
- You can simply use key attributes in the HTML tag to convert the language text. Example: <?php echo $lang["t-ecommerce"]; ?>This is title.</div>
-
Add the below dropdown in the
/layouts/vertical-menu.php
file in the language dropdown.<!-- item--> <a href="?lang=fr" class="dropdown-item notify-item language" data-lang="fr" title="French"> <img src="assets/images/flags/french.jpg" alt="user-image" class="me-2 rounded" height="18"> <span class="align-middle">French</span> </a>
<?php
if (!empty($_SESSION['lang'])) {
$language = $_SESSION['lang'];
elseif ($language == "fr") {
$imgPath = 'https://img.themesbrand.com/Minia/flags/french.jpg';
}
?>