Localization
- Introduction
- Default Locale
- Administrator Locale Menu
- Translations In Config Files
- Available Languages
- Adding A Language
Introduction
Administrator uses Laravel's localization system. Package translations live in src/lang/{locale}/administrator.php and src/lang/{locale}/frontend.php. The application locale and the Administrator locales option determine which language appears in the UI.
Default Locale
Set the application's default locale in config/app.php:
return array(
'locale' => 'en',
);In Laravel 10 applications, you can also wire this value to an environment variable in your application config:
APP_LOCALE=enAdministrator Locale Menu
To show a language selector in the administrator header, add the supported locales to config/administrator.php:
return array(
'locales' => array('en', 'ko', 'ja'),
);If locales is empty, Administrator does not render a separate locale menu.
Translations In Config Files
Global configuration, model configuration, and settings configuration files may use Laravel translation helpers:
return array(
'title' => __('admin.users.title'),
'single' => __('admin.users.single'),
'model' => App\Models\User::class,
'columns' => array(
'name' => array(
'title' => __('admin.users.name'),
),
),
'edit_fields' => array(
'name' => array(
'title' => __('admin.users.name'),
'type' => 'text',
),
),
);Application translation files should follow Laravel's standard lang/{locale} or resources/lang/{locale} layout, depending on the host application structure.
Available Languages
Administrator currently includes the following locale directories:
ar az bg ca da de en es eu fi fr hr hu it ja nb nl pl pt pt-BR ro ru se si sk sr tr uk vi zh-CN zh-TWAdding A Language
Add both translation files for the new locale:
src/lang/en/
administrator.php
frontend.phpUse the existing src/lang/en files as the base structure, then submit a pull request or open an issue on GitHub.