-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
I keep getting missing messages errors #32
Comments
Thank you for the report! Do you think you could share a reproduction (CodeSandbox / Github Repo)? It looks like there's no namespace provided to |
I've just created a CodeSandbox that you can use for a reproduction: https://codesandbox.io/s/next-intl-template-comtb |
@amannn Hello there! https://codesandbox.io/s/next-intl-template-forked-dsctp?file=/pages/_app.js So I changed it and added the getInitialProps to the _app so that messages get loaded here based on the locale in the context and they don't seem to work. According to the docs, this should work so could you take a look? |
Seems like what you pass in the _app.getInitialProps doesn't get passed to the _app pageProps. |
Your example had an infinite loop. In
Yep, when you return something from Here's a fixed version https://codesandbox.io/s/next-intl-template-fixed-x2lvm Does that solve your issue? |
That was indeed a mistake but I had it correct in my code... what did fix it is that I used pageProps.messages instead of messages directly.
The docs seem to use both and I only read the last bit. Could you clarify why there's messages in the props and in props.pageProps of _app? |
Also, it seems to visually work now with {...messages, ...pageProps.messages} BUT I keep getting:
and this is purely serverside |
You're referring to https://github.com/amannn/next-intl/blob/main/docs/usage.md#providing-messages, right? It really depends on your needs. If you have shared messages, you can provide them in
Can you please provide a reproduction for this? |
You can see it in my sandbox as well: The error is Yet the translation does show |
Seems like _app is doing multiple renders and the first render doesn't yet have the props passed from getInitialProps |
I'm sorry, I don't see that error in the CodeSandbox you've linked to. |
Ok... so a lot of figuring out later and it seems like apollo might be the cause of the issue... |
Hmm, that's odd. But then it's not related to the lib? I'll close this issue then. If you find a bug and can provide a reproduction, I'm happy to look into it. Also if anything isn't clear or misleading in the docs, just let me know 🙂 |
@Pixelatex Did you solve the issue in the end? I am currently seeing this error when running
|
@julioflima You need to add |
Thanks to you. That also worked with my project |
Using the latest next 10.x
I have my file setup as:
_app has:
I have checked that it gets locale correctly but console keeps throwing errors:
Any ideas what I could be missing here?
The text was updated successfully, but these errors were encountered: