@@ -45,10 +45,8 @@ Make sure to add it after `StartSession` and before `SubstituteBindings`:
45
45
``` php
46
46
protected $middlewareGroups = [
47
47
'web' => [
48
- \Illuminate\Session\Middleware\StartSession::class, // <= after this
49
48
//...
50
49
\CodeZero\Localizer\Middleware\SetLocale::class,
51
- \Illuminate\Routing\Middleware\SubstituteBindings::class, // <= before this
52
50
],
53
51
];
54
52
```
@@ -110,16 +108,18 @@ Or you can use one or more custom domains for a locale:
110
108
111
109
By default, the middleware will use the following detectors to check for a supported locale in:
112
110
113
- 1 . A custom route action
114
- 2 . The URL (domain or slug)
115
- 3 . A main omitted locale
116
- 4 . The authenticated user model
117
- 5 . The session
118
- 6 . A cookie
119
- 7 . The browser
120
- 8 . The app's default locale
111
+ | # | Detector | Description |
112
+ | :---:| -------------------------| ------------------------------------------------------------------------|
113
+ | 1. | ` RouteActionDetector ` | Checks for a locale in a custom route action. |
114
+ | 2. | ` UrlDetector ` | Tries to find a locale based on the URL slugs or domain. |
115
+ | 3. | ` OmittedLocaleDetector ` | Required if an omitted locale is configured. This will always be used. |
116
+ | 4. | ` UserDetector ` | Checks a configurable ` locale ` attribute on the authenticated user. |
117
+ | 5. | ` SessionDetector ` | Checks the session for a previously stored locale. |
118
+ | 6. | ` CookieDetector ` | Checks a cookie for a previously stored locale. |
119
+ | 7. | ` BrowserDetector ` | Checks the preferred language settings of the visitor's browser. |
120
+ | 8. | ` AppDetector ` | Checks the default app locale as a last resort. |
121
121
122
- Update the ` detectors ` array to choose which detectors to run and in what order.
122
+ Update the ` detectors ` array in the config file to choose which detectors to run and in what order.
123
123
124
124
> You can create your own detector by implementing the ` CodeZero\Localizer\Detectors\Detector ` interface
125
125
> and add a reference to it in the config file. The detectors are resolved from Laravel's IOC container,
@@ -129,11 +129,13 @@ Update the `detectors` array to choose which detectors to run and in what order.
129
129
130
130
The first supported locale that is returned by a detector will automatically be stored in:
131
131
132
- - The session
133
- - A cookie
134
- - The app locale
132
+ | # | Store | Description |
133
+ | :---:| ----------------| -------------------------------------------|
134
+ | 1. | ` SessionStore ` | Stores the locale in the session. |
135
+ | 2. | ` CookieStore ` | Stores the locale in a cookie. |
136
+ | 3. | ` AppStore ` | Sets the locale as the active app locale. |
135
137
136
- Update the ` stores ` array to choose which stores to use.
138
+ Update the ` stores ` array in the config file to choose which stores to use.
137
139
138
140
> You can create your own store by implementing the ` CodeZero\Localizer\Stores\Store ` interface
139
141
> and add a reference to it in the config file. The stores are resolved from Laravel's IOC container,
0 commit comments