INEX SPA provides built-in support for multiple languages, making it easy to create multilingual websites.
INEX SPA allows developers to easily integrate multiple languages into their web applications with just a few simple steps. The framework handles language detection and dynamic content switching using lightweight JSON language files and a powerful Language
class.
To enable multi-language support:
-
Update the
.env
configuration file:DETECT_LANGUAGE=true
This setting allows the framework to manage and remember the user's language preference.
-
Create JSON language files in the
lang/
directory:// lang/en.json { "title": "Hello" } // lang/ar.json { "title": "أهلا" }
-
Use translations in your views:
<h1><?= Language::get('title'); ?></h1>
This will dynamically load the appropriate translation based on the current language.
-
Allow users to switch languages dynamically:
<form> <button type="button" onclick="submitData('setLanguage', [], 'POST', '', ['lang':'en'])">English</button> <button type="button" onclick="submitData('setLanguage', [], 'POST', '', ['lang':'ar'])">العربية</button> </form>
This simple system enables fast and effective language switching without requiring a full reload or complex templating. All translations are managed through JSON files and accessed with the Language::get()
function.
Whether you’re building a multilingual landing page or a global application, INEX SPA’s language system is ready to help you scale with ease.
📚 Read the full documentation here: Enable Multi Language – INEX Docs
✨ Made with INEX.