You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will now find a `localizer.php` file in the `config` folder.
83
77
84
-
####Configure Supported Locales
78
+
### Configure Supported Locales
85
79
86
80
Add any locales you wish to support to your published `config/localizer.php` file:
87
81
88
82
```php
89
83
'supported-locales' => ['en', 'nl', 'fr'];
90
84
```
91
85
92
-
## Drivers
93
-
94
-
#### Detectors
86
+
### Configure Detectors
95
87
96
-
By default the middleware will use the following detectors to check for a supported locale in:
88
+
By default, the middleware will use the following detectors to check for a supported locale in:
97
89
98
90
1. The URL slug
91
+
2. The authenticated user model
99
92
2. The session
100
93
3. A cookie
101
94
4. The browser
102
95
5. The app's default locale
103
96
104
-
If you publish the configuration file, you can choose which detectors to run and in what order.
97
+
You can configure the session key, cookie name and the attribute on the user model that holds the locale.
98
+
By default this is all set to `locale`. If the user model does not have this attribute, it will skip this check.
105
99
106
-
You can also create your own detector by implementing the `\CodeZero\Localizer\Detectors\Detector` interface and add a reference to it in the config file. The detectors are resolved from Laravel's IOC container, so you can add any dependencies to your constructor.
100
+
You can also choose which detectors to run and in what order.
107
101
108
-
#### Stores
102
+
> You can create your own detector by implementing the `\CodeZero\Localizer\Detectors\Detector` interface
103
+
> and add a reference to it in the config file. The detectors are resolved from Laravel's IOC container,
104
+
> so you can add any dependencies to your constructor.
109
105
110
-
The first supported locale that is returned by a detector will then be stored in:
106
+
### Configure Stores
107
+
108
+
The first supported locale that is returned by a detector will automatically be stored in:
111
109
112
110
- The session
113
111
- A cookie
114
112
- The app locale
115
113
116
-
If you publish the configuration file, you can choose which stores to use.
114
+
In the configuration file, you can choose which stores to use.
117
115
118
-
You can also create your own store by implementing the `\CodeZero\Localizer\Stores\Store` interface and add a reference to it in the config file. The stores are resolved from Laravel's IOC container, so you can add any dependencies to your constructor.
116
+
> You can create your own store by implementing the `\CodeZero\Localizer\Stores\Store` interface
117
+
> and add a reference to it in the config file. The stores are resolved from Laravel's IOC container,
118
+
> so you can add any dependencies to your constructor.
0 commit comments