Skip to content

How to get translated data in customer section

I had a task to show the back order message in the mini cart. What I did is just take the message from the customer cart section and show it in the mini cart. Now the problem is with the translation. The message is not translating in the customer section but it is working in cart and checkout page.

enter image description here

What I understood is that the translation only works when content renders in the front end (phtml file). In the cart and checkout page, it is actually rendering on phtml page and that is why it is working.
Let me know if anyone can help me with this.
Thank you.