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.
40
43
41
-
#### Configure
44
+
#### Supported Locales
45
+
46
+
##### Using Slugs
42
47
43
48
Add any locales you wish to support to your published `config/localized-routes.php` file:
44
49
45
50
```php
46
51
'supported-locales' => ['en', 'nl', 'fr'],
47
52
```
48
53
54
+
This will automically prepend a slug to your localized routes. [More on this below](#register-routes).
55
+
56
+
##### Using Domains
57
+
58
+
Alternatively, you can use a different domain or subdomain for each locale by adding them to the `supported-locales` like this:
59
+
60
+
```php
61
+
'supported-locales' => [
62
+
'en' => 'example.com',
63
+
'nl' => 'nl.example.com',
64
+
'fr' => 'fr.example.com',
65
+
],
66
+
```
67
+
68
+
#### Omit Slug for Main Locale
69
+
49
70
Specify your main locale if you want to omit its slug from the URL:
50
71
51
72
```php
@@ -58,6 +79,8 @@ Setting this option to `'en'` will result, for example, in URL's like this:
58
79
- Dutch: `/nl/some-url` as usual
59
80
- French: `/fr/some-url` as usual
60
81
82
+
> This option has no effect if you use domains instead of slugs.
83
+
61
84
## Register Routes
62
85
63
86
Example:
@@ -81,7 +104,7 @@ Route::localized(function () {
81
104
});
82
105
```
83
106
84
-
In the above example there are 5 routes being registered. The routes defined in the `Route::localized` closure are automatically registered for each configured locale. This will prepend the locale to the route's URI and name.
107
+
In the above example there are 5 routes being registered. The routes defined in the `Route::localized` closure are automatically registered for each configured locale. This will prepend the locale to the route's URI and name. If you configured custom domains, it will use those instead of the slugs.
0 commit comments