-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support markup in translated strings #1578
Comments
Now that we have some actual translators working on the translation, this issue crops up a lot. @o-fernandez, we should really prioritize this one, even though we don't actually know how to solve it yet. |
There are now also a lot more places in the code base where we'd need something like this. Added some more details to the ticket description. I feel like with |
Ok, would be good to see if a pod can take it up in this sprint, let's see how it goes in our sprint kickoff today. |
I have a small proof-of-concept ready for this. |
Feature Description
In #1473 we are removing usage of
createInterpolateElement
from the@wordpress/element
package for good, as we can't rely on it being available / provided to us by WordPress (see #1374). We can also not include the package in our final bundle due to licensing.That means, if we want to use markup in translated / internationalized strings, we need to come up with our own solution.
Right now, due to this limitation, we cannot do things like this:
or this:
Instead, we currently have to do workarounds like this:
But concatenating strings like this is bad for translators.
For reference, with
createInterpolateElement
it would look like this:Additional Context
createInterpolateElement
implementation in Gutenberg - uses a simple regex-based tokenizerreact-interpolate-component
- similar API thancreateInterpolateElement
but less readable for translatorshtml-react-parser
- likecreateInterpolateElement
, but a bit larger in size (15.7 kB minified, 6.3 kB minified+gzipped)Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
QA Instructions
The text was updated successfully, but these errors were encountered: