Closed bvsn closed 7 years ago
When dealing with translation you should always do variable replacement after the translation. My suggestion:
__('Message to %email sent successfully').replace('%email', 'foo@example.com');
Yeah, I thought about this option but decided to ask. Thanks for the answer.
I'm not the author of this library, but yeah... In general I think this is best practice.
yeah.
I am trying to define my json files this way: { "Greetings": "Hallo Welt" }, so that I can have strings in the json as key value pairs. And I call it like this: const defaultText = "Hello World"; __(defaultText, "Greetings");
But this can't be processed. I think it's due to defaultText not being a string literal. Is this an intended limitation?
Thanks.
Closing in favour of #6
Is there an option for processing expressions in text?
Example: