Skip to content

Commit 5a1c9ed

Browse files
Merge pull request #41 from Laravel-Lang/patch/2024-07-07/03-02
Added information about the new functionality of the Routes package
2 parents ea106a3 + a4eaee2 commit 5a1c9ed

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
route('localized.show', ['bar' => 'show', 'locale' => app()->getLocale()]);
6+
// https://example.com/fr/foo/show
7+
8+
route('localized.show', ['bar' => 'show', 'locale' => 'de']);
9+
// https://example.com/de/foo/show
10+
11+
route('localized.show', ['bar' => 'show']);
12+
// https://example.com/fr/foo/show
13+
14+
route('localized.show', ['bar' => 'show', 'locale' => 'de']);
15+
// https://example.com/de/foo/show

docs/topics/packages-routes.topic

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<chapter title="Usage" id="usage">
3838
<link-summary>Usage information for the %repository-title-routes% package</link-summary>
3939

40-
<include from="library-models.topic" element-id="video-usage"/>
40+
<include from="library-models.topic" element-id="video-usage" />
4141

4242
<p>
4343
Let's say an application has two localizations installed - French and German.
@@ -530,6 +530,24 @@
530530
of the <code>%config-filename%</code> file.
531531
</p>
532532

533+
<note>
534+
<p>
535+
Since version <a href="https://github.com/Laravel-Lang/routes/releases/tag/1.4.0">1.4</a>,
536+
when calling a localized route name, such as
537+
<code>route('localized.show', ['bar' => 'show'])</code>,
538+
there is no need to specify the current localization code.
539+
</p>
540+
541+
<tabs>
542+
<tab title="After">
543+
<code-block lang="php" src="packages-routes-auto-locale.php" include-lines="11-15" />
544+
</tab>
545+
<tab title="Before">
546+
<code-block lang="php" src="packages-routes-auto-locale.php" include-lines="5-9" />
547+
</tab>
548+
</tabs>
549+
</note>
550+
533551
<chapter title="Examples" id="via_localization_group_examples">
534552
<tabs>
535553
<tab title="Default locale">

0 commit comments

Comments
 (0)