From deeb83ea6b77ef569908367b40d8de145d38c098 Mon Sep 17 00:00:00 2001 From: Evan Date: Thu, 2 May 2024 23:15:52 +0100 Subject: [PATCH] Document tag replacement in localization docs --- localization.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/localization.md b/localization.md index c001b51232..de06d32d6e 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