Multi Language Settings
Let add French language in the existing language.
- Create a new file
i18n/fr.json - You must have to add new language in the
app.jsinsiteLangs: ['en', 'sp', 'fr']array. - Now add the new option of French language in the header language
dropdown menu
views/partials/horizontal.ejs&views/partials/topbar.ejs<!-- item--> <a href="?clang=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 " height="12"> <span class="align-middle">French</span> </a> -
You must have to write all text like
<%=translation.Mega_Menu %>to make it working with all languages. Also make sure to add new words in all other language filesi18n/fr.json. and make sure to add the french.jpg file in thesrc/assets/images/flagsfolder. -
Display selected language add below code above language dropdown list in
views/partials/topbar.ejsfile .<% else if(lang=="fr" ) { %> <img src="/assets/images/flags/french.jpg" alt="Header Language" class="me-1" height="16"> <% } %>