diff --git a/localization.md b/localization.md index 03125e743b..66a9d5725a 100644 --- a/localization.md +++ b/localization.md @@ -226,6 +226,23 @@ public function boot(): void } ``` +<a name="tag-replacement"></a> +#### Tag Replacement + +You may define custom tags which will be replaced within your translation strings: + + echo __( + 'The <docs-link>documentation</docs-link> contains all you need to know!', + [ + 'docs-link' => fn (string $children) => "<a href=\"https://laravel.com/docs\">$children</a>" + ] + ); + +If you are using the [Blade templating engine](/docs/{{version}}/blade) then you will need to echo them using the unescaped `{!! !!}` echo syntax to allow your tags to be rendered correctly. + +> [!WARNING] +> Tag replacements are not the same as XML/HTML tags and do not accept attributes. + <a name="pluralization"></a> ### Pluralization