Skip to content

Commit 9b70383

Browse files
committed
Document namespaced translations
1 parent 58f513b commit 9b70383

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,19 @@ The above will generate:
518518
- /en/materials/glass
519519
- /nl/materials/glazen
520520

521-
Note that in order to find a translated version of a route, you will need to give your routes a name.
521+
If you need to get a translation from a package,
522+
you can pass an optional translation namespace as a third parameter to `Lang::uri()`:
523+
524+
```php
525+
Route::localized(function () {
526+
527+
Route::get(Lang::uri('products/glass', null, 'shop'), ProductsController::class.'@index')
528+
->name('products.glass');
529+
530+
});
531+
```
532+
533+
> Note that in order to find a translated version of a route, you will need to give your routes a name.
522534
If you don't name your routes, only the parameters (model route keys) will be translated, not the "hard-coded" slugs.
523535

524536
## 🚏 Route Parameters

0 commit comments

Comments
 (0)