Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Minimal example #2

Open
mikemajara opened this issue May 26, 2021 · 4 comments
Open

Minimal example #2

mikemajara opened this issue May 26, 2021 · 4 comments

Comments

@mikemajara
Copy link

Amazing work here @LuudJanssen cheers!

I was wondering if you could post a minimal working example. I have had some trouble setting this up with basic errors such as

  • replacing the client side next/link and next/router with @luudjanssen/next-locale-router which throws a Module not found 'fs' meaning it's being executed on the client... but using fs
  • readme seems to be outdated, so I'm wondering if anything changed as all my URLs are shwoing PASSTHROUGH when debugging. (@incentro/... vs @luudjansen/...)

I am currently using this example to test: yarn create next-app --example i18n-routing i18n-app (Link)

@LuudJanssen
Copy link
Owner

Hi @mikemajara! Awesome you found this package on your own. This project is actually part of a closed-source project for one of my customers, so I'm still working on getting them to agree with publishing this under an MIT license, so I can invest in making this package ready for open source.

I'll keep you updated in this thread as to the status of this. If I get a "go" I'll look at the issues you mentioned and help you get this set-up :)

@mikemajara
Copy link
Author

mikemajara commented May 26, 2021

Hey @LuudJanssen thanks so much for the prompt response! I would imagine is for a private customer, but thanks for letting me know it's closed-source for now.

I would be really keen in getting this to work as I see potential for use on other projects. For now, I was just surprised that NextJS has this limitation when looking at translations, but have other workarounds and this is not critical for my project.

FYI: I also posted a question in stackoverflow, when seeing how hard this was to achieve in NestJS. I have also found this to be simpler, or at least achievable with Gatsby in this discussion that also led me to Dan Abramov's blog.

While you get a repsponse to publish this with MIT license, any input or advise on any of the above would be highly appreciated!

@LuudJanssen
Copy link
Owner

Hi @mikemajara! No problem :) Thank you for your interest!

It isn't closed-source per say, but the license is "UNLICENSED" for now, which essentially means the default copyright laws apply, which state that you can't use the code without explicit permission.

I definitely see the potential too. I just contacted my client again to get the process expedited, and hopefully get the "go" soon. Thank you for linking your question on Stackoverflow. I'll definitely post this solution there when I'm good to go.

With regards to your current situation, I can only share you bad news. There is no workaround for this in Next.js currently that I know of, hence why we created this package in the first place. You should ask yourself the question how important this functionality is for you, so changing internationalized routes from "nl-BE" to "nl" for example. In our case it was a legacy problem, we already had the /nl/ routes, so there was no way back, except for adding a lot of redirects.

Only thing you can do right now is:

  1. Don't use getStaticProps
  2. In pages/ create [language].tsx
  3. Do internationalized routing / rendering yourself based on the language parameter

I'll keep you posted!

@mikemajara
Copy link
Author

Hey @LuudJanssen Thanks so much for the tips! 🙏 I'll keep an eye out 👀

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

No branches or pull requests

2 participants