How to Use Localization with lang/ru.json
and lang/en.json
in Lin2Web
✅ 1. Translation Structure
Translations are stored in:
bashКопироватьРедактировать/lang/en.json
/lang/ru.json
Example content of en.json
:
jsonКопироватьРедактировать{
"Create": "Create",
"Dashboard": "Dashboard"
}
Example content of ru.json
:
jsonКопироватьРедактировать{
"Create": "Создать",
"Dashboard": "Панель"
}
✅ 2. Setting the Default Language
In the config/app.php
file, set the default locale:
phpКопироватьРедактировать'locale' => 'en', // Default language
'fallback_locale' => 'en',
✅ 3. Using Translations in Templates
Simply use:
bladeКопироватьРедактировать{{ __('Create') }}
Laravel will automatically fetch the translation from the appropriate *.json
file based on the current locale (App::getLocale()
).