Shortcodes in hydrate client component (static content in hydrated components)
See original GitHub issueHi,
I am trying to do translation. I’d like to replace all all id’s to translated string. I did an helper which generate id’s and can add additional data.
<h2 class="vf-h2 center">{T.gST('convert.how-use.head', `How does it work?`)}</h2>
is generated to
<h2 class="vf-h2 center">__t__convert.how-use.head:eyJkZWZhdWx0IjoiSG93IGRvZXMgaXQgd29yaz8ifQ==</h2>
then it is replaced via html hook (there are adicionalita data for example variable for passing to translation) to final string.
Everything works in static components. But I do not known how to add static content into hydrate component (hydrate-client={{}}
). It could be nice to apply shortcodes replace function to all components before there is anything to do (it will replace all shortcodes in all components). Or add hook beforeComponentCompiled, then users will be able to do some string replace.
Or do you have idea how to add static content into hydrated component during compiling (in my case replace translation id’s to translated text)?
Thank you.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top GitHub Comments
I think the correct way is to pass the content of your shortcode into your hydrate component. Like this: Route component
Clock svelte
@nickreese I tried
helpers.shortcode
first. But I can not find a way how to use it in included components.Route component
Clock.svelte
Clock-26f12bb3.js