cibernox / svelte-intl-precompile

I18n library for Svelte.js that analyzes your keys at build time for max performance and minimal footprint
https://svelte-intl-precompile.com
ISC License
274 stars 13 forks source link

HTML support #61

Closed EskelCz closed 1 year ago

EskelCz commented 1 year ago

Is there a way to incorporate basic HTML tags? In principle, if this is even a valid feature request or not.

Right now I have to concatenate strings to achieve basic formatting (bold, italic etc), or simply don't use the locale files for certain texts at all.

cibernox commented 1 year ago

Right now you can use the {@html t('foo')}, since the one escaping HTML tags is svelte itself, not this library. However I agree it's not very convenient if you have a lot of situations where this is common.

I did see that some i18n libraries use some kind of convention, like having translations keys ending in _html be automatically unscapped, that could make it more convenient but i haven't investigated much about how that would be possible with svelte.

EskelCz commented 1 year ago

{@html t('foo')} is just what I needed. Thanks a lot