You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to debug this myself, found the problem in the innerTextspecs, quoting:
If the element itself is not being rendered (for example, is detached from the document or is hidden from view), the returned value is the same as the Node.textContent property.
I can't think of a workaround for this without making assumptions about the text content itself (for example, only preserving newlines after a period).
Is storing the default language in the html itself a good idea?
Motivation was/is some basic SEO without needing SSR, otherwise the default content will need to be retrieved from a json and added to the HTML in runtime.
The text was updated successfully, but these errors were encountered:
I think making sure served HTML default translatable content respects desired visual line breaks is the easiest workaround for now.
Will add a note in README for now.
What about using innerHTML instead of innerText?
This way we could get closer to React's <Trans></Trans> component functionality, that is, respect markup inside translations.
Downside is the danger of inserting HTML from json files...
Will reopen to try this out, or give more thoughts to it.
tomyo
changed the title
Default language cached in sessionStorage from HTML has messed up line breaks
Default language cached in sessionStorage from HTML can have messed up line breaks
Oct 18, 2022
Trying to debug this myself, found the problem in the
innerText
specs, quoting:I can't think of a workaround for this without making assumptions about the text content itself (for example, only preserving newlines after a period).
Motivation was/is some basic SEO without needing SSR, otherwise the default content will need to be retrieved from a json and added to the HTML in runtime.
The text was updated successfully, but these errors were encountered: