Skip to content
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

Translations which are displayed using @html are missing #743

Open
alinex opened this issue Sep 18, 2023 · 0 comments
Open

Translations which are displayed using @html are missing #743

alinex opened this issue Sep 18, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@alinex
Copy link

alinex commented Sep 18, 2023

Version

5.26.2 with svelte 4.2.0

Describe the bug

On first load the translation text will not be displayed (output as empty string <p></p>) . If the language is changed it will display. I found a workaround: if I display a variable, which is updated with a short timeout it will show.

I don't know if it is a svelte or typesafe i18n problem. But it looks like is based on a bad timing.

How can I fix this, without the workaround?

Reproduction

<script>
	import { LL } from '$i18n/i18n-svelte';
	let lin = '';
	setTimeout(() => (line = $LL.intro.paragraph[0]()), 1);
</script>

<h3>Missing content on load</h3>
<ul>
  <li>{@html $LL.intro.paragraph[0]()}</li>
</ul>

<h3>Working</h3>
<ul>
  <li>{$LL.intro.paragraph[0]()}</li>
  <li>{@html line0}</li>
  <li>{@html "Some text"}</li>
</ul>

Logs

No response

Config

{
   "$schema": "https://unpkg.com/typesafe-i18n@5.26.2/schema/typesafe-i18n.json",
   "adapter": "svelte"
}

Additional information

No response

@alinex alinex added the bug Something isn't working label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant