-
-
Notifications
You must be signed in to change notification settings - Fork 765
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
Define functionality and features #1
Comments
My main issue with the example was routing. It is great, and I think necessary, to provide some basic implementation of subpath.
I implemented something that fill my needs nicely (with a config file for route and some "helper" reading it, so to have it all in one place), but I guess some pointer in comments might be usefull ( like //route masking is managed here !) |
Hi @Eruilz. So, in this project, you would import several things from server.js
component.js
Or at least, this is my first thoughts/approach. Does this seem simple enough? It is true that imperative use of It may be possible to rewrite the subpath functionality as a In general I would prefer to hook into What do you think? |
@isaachinman well routeChangeStart looks like a good idea... until you look into nextjs code where it is said to be deprecated "soonish"... so not really sure that should be the way :) In the example, it was "simple" to use your implementation, but confusing (at least that is what I thought) to add route masking functionality. |
@Eruilz I did not see that it was being deprecated soon. Can you link to that? I'm not actually convinced that it's better to intercept We're well aware of Any comments about that potential installation / use flow above? |
|
|
I must have misunderstood something then, sorry :) |
@timneutkens Thanks for chiming in and letting me know - that's good to hear. Out of curiosity, do you think hooking into
@revskill10 Do you have an example of a Lambda-friendly NextJs project with custom routes? As far as I know, it will be literally impossible to support custom routes with NextJs without manually declaring our Express server, etc. Could be totally wrong there. @revskill10 Also, can you explain what you mean about imperative methods? Normal use case would involve importing |
|
@timneutkens Do you mind explaining why? I'm happy to proceed that way, but it does create a "less simple" solution for the end user, and can result in some gotchas when it comes to imperative use of the router. |
@isaachinman what about using some helper calling next/router functions ? so we would load
Would that be acceptable or are we running in the same scalability issues ? |
Hey @Eruilz, that's a great idea. We can export both I think we're actually pretty close to being able to start working on a pre release. My last concern is: the config will be exactly the same as this, but we'll need to think of a good way to allow users to override settings, both for the client and server. Our i18n instance will be handled completely internally and will not be exposed to the end user at all. I suppose instead of doing |
I use i18n instance to retrieve current language and display country flag according to current language, there could be other use case I guess.
I may also have missed something and there is an other way ? |
@Eruilz Thanks for pointing that out. Perhaps it's just best to export the i18n instance after all, and make it clear via documentation that users should only import/change the instance if they understand what it does. I forgot to include in the server/component example above, that users will also need to take a third step: create an _app.js:
I'm still not clear on exactly how a HOC on |
I wonder if we could introduce some kind of extensibility point for this, because exposing the router through the i18n package would mean that you'd be responsible for API-compatibility and it would confuse new users that read the Next.js documentation and then use next/router instead. |
I just realized the i18n link might not cover all next/link use cases: https://github.com/i18next/react-i18next/blob/master/example/nextjs/components/Link.js#L32 For example you could do:
Which would end up being
Also next/link accepts objects that are ran through |
To come back to this, I think it makes a lot of sense to actually not expose the global |
Hey @timneutkens.
I think we'd just be importing directly from
Yes, that is the main concern. In general it's going to be very tricky to make a localised SSR app "easy", and I'd rather not build in confusing patterns.
Yes, that's correct. My goal with that example was to keep things as simple and easy-to-understand as possible - it's a starting point for devs. If we're proceeding here with a
This is an interesting suggestion. I do not have previous experience using |
@timneutkens As far as extensibility, I've always felt as though there should be another
This would allow the kind of functionality we're talking about here, but also allow for protecting logged-in routes, and so on. Just a thought, it could be ill-advised for some reason unbeknownst to me. Update: it's already been discussed here and here, and probably elsewhere. No point discussing over in this repo. |
We don't want to add global routing side-effects to the router.
This is actually something I've been thinking about deprecating for a long time, it's a stateful module, which makes code-splitting it harder whereas |
Probably a good idea. It might also make a lot of sense to line that up with the new React hooks stuff. For this |
Yeah, using the router will look like this: https://twitter.com/timneutkens/status/1057053195044823040 |
@revskill10 Any update about Lambda support before I get started on this? |
@isaachinman What i think is we should limit configuration on server side, to adapt i18next for lambda function. |
@revskill10 I do not understand what you mean at all. This project sets out to be a drop-in utility to get If you want changes made to the This project will definitely be exporting a middleware, which is indeed just a function that takes If you don't have access to a filesystem or Express/Koa/http, I honestly don't know how you plan to achieve SSR with localisation. Feel free to open an issue on whatever repo you think is appropriate for your feature request. |
With this example, is there any way to use SSR with hooks on the frontend? |
@DmacLoyaltyOne Can you explain your use case? If you're referring to React hooks, that functionality has not even landed in React core yet, and is of course not supported here until that happens. |
@isaachinman Yes that is what I was referring to. Since there is a section devoted to using react-i18next with hooks in the documentation, I figured there might be a way to get it to work with SSR, but you're telling me that is not the case yet, correct? |
@DmacLoyaltyOne I think what you're referring to is @jamuhl's work in preparation for v10. This repository is a WIP, and will be a tool to quickly and easily add i18next to NextJs projects. Support in this project for hooks depends on: (1) React release, (2) I have not yet played with hooks in relation to SSR, but I don't see how it'd make any difference vs clientside. If you want to continue discussion on this topic, please open an issue in |
Hello everyone - I will be releasing v0.1.0 of this project on npm shortly. I would appreciate some early testers to provide feedback if anyone can do that. Thanks! |
Thx @isaachinman , I will take a look ASAP (right now, it's family time !) |
So we just completed a rewrite of the react-i18next NextJs example. This is/was an example, and we intentionally avoided abstracting or hiding things away, as we specifically wanted people to understand what was happening.
Through the process, several devs indicated that they would be interested in a
next-i18next
project which could be installed from npm and set up with minimal work.This repo will potentially be that util, but we need to define a lot of characteristics before work can start.
What exactly are people looking for? How much of the configuration can be hidden away from users? How do we provide overrides?
At the very least:
_app.js
component in.Link
from us (not NextJs), if they would like to use language subpaths. There might be another solution here I'm not thinking of.server.js
.The text was updated successfully, but these errors were encountered: