Appearance
Translations
JetShip supports multiple languages, allowing you to localize your project easily. This guide will walk you through how to use translations in JetShip. We use the Laravel Translatable String Exporter to manage language files efficiently.
🔄 Making Text Translatable
To make any text translatable, simply wrap it with the __()
helper function. For example:
php
{{ __('Welcome to JetShip') }}
This ensures that the text can be translated into different languages.
⚙️ Generating Translatable Files
To generate translation files for a specific language, use this command:
bash
php artisan translatable:export fr
This will create a file lang/fr.json
that maps English strings to French translations. You will need to manually translate the strings in this file.
TIP
Replace fr
with the language code of your choice to create translations for other languages.
🌐 How to Switch the Language
1. Admin Panel Language Switch
JetShip uses the Filament Language Switch Plugin for the admin panel. You can easily switch languages from the language toggle menu at the top-right corner of the navbar.
2. Frontend Language Switch
To change the language on the frontend, simply update the APP_LOCALE
variable in your .env
file:
bash
APP_LOCALE=fr