Would be great to include a utility to overlay translations onto DOM, as per https://github.com/projectfluent/fluent.js/wiki/DOM-Overlays.
Obviously in PHP we work with HTML strings rather than the DOM itself, so the API would be slightly different.
In my abandoned fluent-php library, I had a 1:1 port of this functionality working with this API:
Overlay::translateHtml(
'<p><img data-l10n-name="world" src="world.png"></p>',
[
'value' => 'Hello, <img data-l10n-name="world" alt="world">!',
'attributes' => ['title' => 'Hello']
]
);
// → <p title="Hello">Hello, <img data-l10n-name="world" alt="world" src="world.png">!</p>
Would be great to include a utility to overlay translations onto DOM, as per https://github.com/projectfluent/fluent.js/wiki/DOM-Overlays.
Obviously in PHP we work with HTML strings rather than the DOM itself, so the API would be slightly different.
In my abandoned fluent-php library, I had a 1:1 port of this functionality working with this API: