Multi Language Settings
Let's add the French language.
- Create a new file fr.php in the fr folder in the
app/Language
folder and copy theen.php
file code in this file. -
Now you need to add the language in the
public/assets/js/app.js
file. In the function setLanguage, add the "Switch case" condition as below code and make sure to add the french.jpg file in thepublic/assets/images/flags
folder.case "fr": echo '<img src="assets/images/flags/french.jpg" alt="Header Language" height="16">'; break;
- You can simply use key attributes in the HTML tag to convert the language text. Example: <div data-key="t-title">This is title.</div>
-
Add the below dropdown in the
app/views/partials/topbar.php
file in the language dropdown.<!-- item--> <?php if($lang !== 'fr'): ?> <a href="<?= base_url('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>