laravel-enso/localisation
Localisation
Description
Localisation manages Enso languages, JSON translation files, and request-time language selection.
The package exposes language CRUD and translation-file editing endpoints, registers the set-language middleware alias, and ships commands for publishing locale files and scanning the codebase for missing translation keys.
It is intended for Enso applications that maintain multiple UI languages and JSON translation stores.
Installation
Install the package:
composer require laravel-enso/localisation
Run the package migrations:
php artisan migrate
Optional publishes:
php artisan vendor:publish --tag=localisation-config
php artisan vendor:publish --tag=localisation-factory
php artisan vendor:publish --tag=localisation-seeder
Features
- Language CRUD, options, table init, table data, and Excel export endpoints.
- JSON translation editing, saving, and key-creation endpoints.
set-languagemiddleware alias for per-request locale switching.enso:localisation:publishcommand for generating locale folders and JSON files.enso:localisation:scancommand for finding missing keys, frontend and selectable enum labels, registered model values, and duplicate translations.
Usage
Main route groups:
system.localisation.*system.localisation.editTextssystem.localisation.getLangFilesystem.localisation.saveLangFilesystem.localisation.addKey
Artisan commands:
php artisan enso:localisation:publish --locale=ro
php artisan enso:localisation:scan --dry-run
The scan command reads the configured source paths and also collects labels from frontend enums and native enums implementing LaravelEnso\Enums\Contracts\Select by default. Disable enum label collection through the published config when needed:
'scan' => [
'enums' => false,
],
Packages may expose database-backed translation keys by extending
LaravelEnso\Localisation\TranslatableModelServiceProvider and listing models
that implement LaravelEnso\Localisation\Contracts\TranslatableAttributes.
The provider registers models only while enso:localisation:scan is running.
API
HTTP routes
GET api/system/localisation/createPOST api/system/localisationGET api/system/localisation/{language}/editPATCH api/system/localisation/{language}DELETE api/system/localisation/{language}GET api/system/localisation/initTableGET api/system/localisation/tableDataGET api/system/localisation/exportExcelGET api/system/localisation/optionsGET api/system/localisation/editTextsGET api/system/localisation/getLangFile/{language}PATCH api/system/localisation/saveLangFile/{language}PATCH api/system/localisation/addKey
Middleware
set-language
Artisan commands
enso:localisation:publishenso:localisation:scan
Depends On
Required Enso packages:
laravel-enso/core↗laravel-enso/forms↗laravel-enso/helpers↗laravel-enso/migrator↗laravel-enso/select↗laravel-enso/tables↗laravel-enso/users↗
Companion frontend package:
Contributions
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!