Managing Languages and Translations
When visitors access the website without specifying a language (e.g., en-us
), they are automatically redirected to the version in the language of their browser. This ensures content is delivered in their native language if available. Additionally, multilingual URLs remain available for SEO and direct linking.
Multilingual Support
Our script offers multilingual support, including several pre-installed translations. These translations reside within the lang
directory, each within its own folder named after its respective locale standard (e.g., en_US
, pt_BR
).
Content such as the Contact, Privacy Policy, and FAQ pages are located in the lang/<locale>/md
directory. In this directory, you will find Markdown files which can be edited to modify the content.
Activating and Deactivating Languages
After the installation of the script, only en_US
is active.
Activating a Language
To activate a language, navigate to the config.php
file in the language's folder (lang/<locale>/config.php
) and set the active
attribute to true
:
/*
|--------------------------------------------------------------------------
| Language Activation
|--------------------------------------------------------------------------
|
| This configuration determines whether the language is active. If set to 'false',
| the language will not appear in the language selection dropdown or the dashboards.
|
*/
'active' => true,
/*
|--------------------------------------------------------------------------
| Text Direction
|--------------------------------------------------------------------------
|
| This configuration sets the text direction for the language.
| Possible values are 'ltr' (left-to-right) and 'rtl' (right-to-left).
|
*/
'dir' => 'ltr',
Deactivating a Language
To deactivate a language, either:
-
Remove the relevant folder in the
lang
directory (e.g.,lang/<locale>/
). -
Open the
config.php
file in the language folder (lang/<locale>/config.php
) and set theactive
attribute tofalse
:
/*
|--------------------------------------------------------------------------
| Language Activation
|--------------------------------------------------------------------------
|
| This configuration determines whether the language is active. If set to 'false',
| the language will not appear in the language selection dropdown or the dashboards.
|
*/
'active' => false,
Important Note: If your application exclusively uses a language other than en_US
, adjust the config/app.php
file accordingly by altering both the locale
and fallback_locale
:
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale defines the default locale that the translation
| service provider will utilize. Feel free to set this value to any of
| the locales supported by your application.
|
*/
'locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale specifies the locale to use when the current one
| is unavailable. You can modify the value to match any of the
| language folders provided in your application.
|
*/
'fallback_locale' => 'en_US',
When only one language is active, the language selection dropdown will not appear.
Adding New Languages
To add a new language, follow these steps:
- Copy the main language directory
lang/en_US/
. - Translate all the files within this directory.
- Rename the new directory to match the ISO-compatible locale name (
language_COUNTRY
).
The locale identifier consists of a lower-case language code (ISO 639-1) and an upper-case country code (ISO 3166-1), separated by an underscore. For example, en_US
represents American English, while pt_BR
stands for Brazilian Portuguese.