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 `localized-routes.php` file in the `config` folder.
43
43
44
-
#### Supported Locales
44
+
#### ☑️ Supported Locales
45
45
46
46
##### Using Slugs
47
47
@@ -65,7 +65,7 @@ Alternatively, you can use a different domain or subdomain for each locale by ad
65
65
],
66
66
```
67
67
68
-
#### Omit Slug for Main Locale
68
+
#### ☑️ Omit Slug for Main Locale
69
69
70
70
Specify your main locale if you want to omit its slug from the URL:
71
71
@@ -81,7 +81,7 @@ Setting this option to `'en'` will result, for example, in URL's like this:
81
81
82
82
> This option has no effect if you use domains instead of slugs.
83
83
84
-
## Register Routes
84
+
## 🚗 Register Routes
85
85
86
86
Example:
87
87
@@ -124,9 +124,9 @@ If you set `omit_url_prefix_for_locale` to `'en'` in the configuration file, the
124
124
| /admin/reports | en.admin.reports.index |
125
125
| /nl/admin/reports | nl.admin.reports.index |
126
126
127
-
**Beware that you don't register the same URL twice when omitting the locale.** You can't have a localized `/about` route and also register a non-localized `/about` route in this case. The same idea applies to the `/` (root) route! Also note that the route names still have the locale prefix.
127
+
**⚠️ Beware that you don't register the same URL twice when omitting the locale.** You can't have a localized `/about` route and also register a non-localized `/about` route in this case. The same idea applies to the `/` (root) route! Also note that the route names still have the locale prefix.
128
128
129
-
### Generate Route URL's
129
+
### 🚕 Generate Route URL's
130
130
131
131
You can get the URL of your named routes as usual, using the `route()` helper.
> **Note:** in a most practical scenario you would register a route either localized **or** non-localized, but not both. If you do, you will always need to specify a locale to get the URL, because non-localized routes always have priority when using the `route()` function.
165
165
166
-
### Redirect to Routes
166
+
### 🚌 Redirect to Routes
167
167
168
168
Laravel's `Redirector` uses the same `UrlGenerator` as the `route()` function behind the scenes. Because we are overriding this class, you can easily redirect to your routes.
169
169
@@ -178,7 +178,7 @@ You can't redirect to URL's in a specific locale this way, but if you need to, y
178
178
return redirect(route('about', [], true, 'nl')); // redirects to /nl/about
179
179
```
180
180
181
-
### Translate Routes
181
+
### 🌎 Translate Routes
182
182
183
183
If you want to translate the segments of your URI's, create a `routes.php` language file for each locale you [configured](#configure-supported-locales):
184
184
@@ -219,7 +219,7 @@ The above will generate:
219
219
220
220
> If a translation is not found, the original segment is used.
221
221
222
-
## Route Placeholders
222
+
## 🚏 Route Placeholders
223
223
224
224
Placeholders are not translated via language files. These are values you would provide via the `route()` function. The `Lang::uri()` macro will skip any placeholder segment.
0 commit comments