Skip to main content
Version: 1.0

Localization

Laravext supports (ever since version v1.3.1), native route localization. Simply change the 'laravext.localization.enabled' and the 'laravext.localization.locales' localization configuration as you see fit, and the/lang/[language-key-added-in-config]/routes.php files with the translations, like so:

config/laravext.php:

'localization' => [
/**
* Whether or not the localized routing feature is enabled.
*/
'enabled' => false,

/**
* The available locales for the application. By default, it will attempt to use the
* APP_LOCALES environment variable, falling back to English.
*
* This example adds the 'pt' and 'es' locales to the available locales, but
* in the original configuration, you'll notice it's set only as ['en'].
*/
'locales' => env('APP_LOCALES') ? explode(',', env('APP_LOCALES')) : config('app.locales', ['en', 'pt', 'es']),

// Other configs
],