tolgee / tolgee-js

Tolgee JavaScript libraries monorepo
https://tolgee.io
MIT License
236 stars 28 forks source link

Calling client side code from server side #3400

Closed alvarolozano closed 3 weeks ago

alvarolozano commented 3 weeks ago

The detectLanguageFromHeaders is supposed to be a SERVER function, but it is calling the detectLanguage function which is supposed to be a CLIENT function

https://github.com/tolgee/tolgee-js/blob/358707421c721a0454f6be9d2963ccf27820ba76/packages/web/src/package/tools/detectLanguageFromHeaders.ts#L9

So this line makes the initialization to fail, because it is calling the window object from the server. https://github.com/tolgee/tolgee-js/blob/358707421c721a0454f6be9d2963ccf27820ba76/packages/web/src/package/LanguageDetector.ts#L13

alvarolozano commented 3 weeks ago

Possibly fixed in https://github.com/tolgee/tolgee-js/pull/3401

stepan662 commented 3 weeks ago

Fixed in #3401