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

Window.lang is giving error when converting app to a server side rendered one #105

Open
carlosersantos opened this issue Sep 30, 2024 · 1 comment

Comments

@carlosersantos
Copy link

I'm in the process of converting an existing Angular app where we were using Orejime, to a Server Side Rendered one out of necessity.
However, since the window object does not exist in the server, Orejime, specifically is breaking on the language function due to the usage of window.language (and document.documentElement.lang for the same reason that document does not exist).
Is a fix/workaround possible?

function language() {
  return window.language || document.documentElement.lang || "en";
}
@felixgirault
Copy link
Contributor

Hi,
Did you consider loading Orejime on the client only?
I don't think there is a great benefit in prerendering it. Also, it is not really designed to be used on the server because it relies heavily on DOM APIs to update elements in the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants