Sign in
Log inSign up
Andreas Söderlund

35 likes

·

2.6K reads

8 comments

Ayush Agarwal
Ayush Agarwal
Jan 14, 2023

Very nice explained Andreas, great code snippets to code and learn along.

1
·
Pavel Stianko
Pavel Stianko
Jan 19, 2023

Thanks for the awesome content Andreas! Best article about typesafe-i18n that I found! I am using routing for lang detection, but the content of the page is changing when I hover the links to different lang version (I am using hrefs to /de, /en,..). I know I can disable data preload in sveltekit, but is there any better solution? Thank you!

1
·
·1 reply
Andreas Söderlund
Andreas Söderlund
Author
·Jan 19, 2023

Hi Pavel, glad you like the article! :) I see the problem. In this case I'd pass the "LINK" translation string/locale as page data instead, so it's definitely available.

·
Tobias
Tobias
Mar 26, 2023

Thank you so much for this article! It made it so clear and simple to follow along and saved me so much time. I'd like to ask you if you prefer using the route- or cookie-way of doing it? I think using a cookie would be simpler and easier to maintain but I can't see what are the disadvantages?

1
·
·2 replies
Andreas Söderlund
Andreas Söderlund
Author
·Mar 26, 2023

Hi Tobias, I'm glad I could make things easier for you. :) I can't say I have a preference, the method to use depends on the site and its requirements. Cookies makes for cleaner routes, but from a SEO perspective it could be better to use the route way, for example. It's hard to say without knowing more about the specific site you're making.

1
·
Tobias
Tobias
Mar 26, 2023

Andreas Söderlund Ok, thank you for your answer. I don't have any specific requirements for it's a side-project I'm working on but I thought it could have implications for seo but wasn't sure about it. I'll try to find some resources to make a more profound decision.

·
Jens
Jens
Feb 25, 2023

Great article! The only two things that I am missing is the automatic detection of the browser language through the header and a language switcher - could you possibly add this in the future? 🙏

·
·1 reply
Andreas Söderlund
Andreas Söderlund
Author
·Mar 6, 2023

Hi Jens, I think I'll leave that as an exercise to the reader, it should be quite easy to modify the cookie example at the end to look at the relevant headers instead of the cookie data.

·