Closed RedEagle-dh closed 1 week ago
I found the root cause of the issue. It was due to an error on my end where I used the wrong name in the function mapping for t.rich. After correcting it, the rich text rendering works as expected.
Apologies for the confusion, and thank you for your time and support!
I’m closing this issue now.
Description
When using
t.rich
with translations that contain placeholders like<strong1>
, the expected behavior is that the content between these placeholders is rendered according to the mapping provided in thet.rich
call. However, due to the bug, the output is only the translation key (e.g.,IndexPage.subtitle
) rather than the processed translation content.Verifications
Mandatory reproduction URL
https://github.com/RedEagle-dh/next-intl-bug-placeholders-not-rendered
Reproduction description
Clone the repository:
Install dependencies: Make sure you have Node.js installed, then run:
Start the development server:
Open the application in your browser: Navigate to
http://localhost:3000
.Trigger the bug:
IndexPage.subtitle
will be displayed instead of the expected text content with the rich text formatting applied.Expected behaviour
The
t.rich
function should correctly parse the placeholders in the translation (e.g.,<strong1>...</strong1>
) and render the content according to the provided mappings. For example, if the translation inde.json
is:The expected output should display
Welcome
andto Next.js!
wrapped in the appropriate React components as defined in thet.rich
call.