diff --git a/localization.md b/localization.md index c001b512327..de06d32d6e6 100644 --- a/localization.md +++ b/localization.md @@ -198,6 +198,23 @@ In these cases, Laravel allows you to register a custom formatting handler for t }); } + +#### Tag Replacement + +You may define custom tags which will be replaced within your translation strings: + + echo __( + 'The documentation contains all you need to know!', + [ + 'docs-link' => fn (string $children) => "$children" + ] + ); + +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. + ### Pluralization