-
-
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
Port for Remix? #78
Comments
Hey @ryexley, Great to hear that you like The integration with Next.js is in fact really slim: The only thing it does is reading a preconfigured No idea if Remix has a concept of configuring a locale? If so we could think about a |
@amannn - I would love to start this conversation. I'm not real familiar with, internally, how next.js makes locale information available to the app, but I do know that configuring next-intl, if I'm not mistaken, requires the addition of (or, perhaps just takes advantage of this?) the |
The only thing So if Remix exposes a locale similarly, I think |
I will look into that. Thanks! |
Great, let me know how it goes! |
I was able to get a bit of a hacky implementation working. Wasn't able to figure out how to get Remix to dynamically resolve and load the translation file from the config settings, but I did get the |
Nice job! Is the |
I ended up doing this in |
I've now added a Remix example, maybe it's helpful to you 🙂. https://github.com/amannn/next-intl/tree/main/packages/example-remix |
Ooohhhh thanks @amannn!! I love that your example has the util functions for dynamically evaluating the language and resolving the language files by reading from the file system, that's what I was needing in my solution. The only suggestion I would make for it would be to actually wrap the |
Also, I've been wondering this. Is there a way to get a translator function outside of a hook, like, for use on the server side? |
Great to hear if this is helpful! 🙂
Can you elaborate on why that would be a good idea? On the client, if you don't import the messages directly into the bundle, you'd have to fetch them asynchronously before you're able to render and therefore this would delay the time to interactive. The loader that can be used in
There's currently an open issue about this, but I didn't have the time to look into this yet: #47 |
I don't fully grok how |
As far as I understand hose files are the entry points for the client and server respectively, i.e. the first thing that runs in the given environment. They definitely allow you to wrap the tree, but I'd suggest to not do anything async in the client side entry point, as it will delay the client side render. So for a use case of importing messages from one locale statically this will work just fine, but once you have multiple locales and need dynamic imports, an unnecessary delay will be introduced. By wrapping the tree in Note to myself: Maybe something that would be interesting for a potential |
I really like this library, we've used it with great success in our next.js apps. I've been very interested in using Remix lately, and was wondering how difficult it would be to port this simple, elegant solution over to support Remix as well. Have you done anything with Remix yet at all @amannn??
The text was updated successfully, but these errors were encountered: