opral / inlang-paraglide-js

Tree-shakable i18n library build on the inlang ecosystem.
https://inlang.com/m/gerre34r/library-inlang-paraglideJs
22 stars 0 forks source link

docs are confusing regarding race conditions #150

Closed samuelstroschein closed 3 weeks ago

samuelstroschein commented 3 weeks ago

Context

Someone on reddit wrote

Also, Paraglide suffers from the same race conditions during SSR as basically all other frameworks. They even acknowledge the flaw and comment it with a mere "The language tag is global, so you need to be careful with it on the server to make sure multiple requests don't interfere with each other. Always use a getter-function that returns the current language tag for the current request." Using globals on the server just calls for trouble - still it's baked into the design of Paraglide.

I replied with

This is not true. (If it is, file a bug) If you use Paraglide JS without a framework "adapter", you have to make sure to call the global variable in a scoped context yourself. That's why we have this warning in the docs. Every Paraglide framework specific version takes care of using the locale/languagetag variable in a scoped context on the server.

https://www.reddit.com/r/sveltejs/comments/1dbx0ps/comment/l7uip5b/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

Proposal

Clarify the docs that framework specific versions use the variable in a scoped context.