aralroca / next-translate

Next.js plugin + i18n API for Next.js 🌍 - Load page translations and use them in an easy way!
MIT License
2.66k stars 206 forks source link

Does it work with nextron? #570

Closed nativedone closed 3 years ago

nativedone commented 3 years ago

Hi,

I'm trying to set up a minimal example working with Nextron (https://github.com/saltyshiomix/nextron).

The problem I'm facing is:

Therefore, the nextron build command returns the following error:

Cannot build electron packages: Error: Command failed with exit code 1: next export -o ../my-app-i18n/app ../my-app-i18n/renderer

Error: i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/deployment

Below there is a branch where you can reproduce the issue. Any guidance would be much appreciated!

https://github.com/nativedone/nextron-i18n/pull/1/

aralroca commented 3 years ago

How it says in error: i18n support is not compatible with next export. So until it is supported in Next.js core it will not be possible, which underneath uses Next.js i18n routing.

nativedone commented 3 years ago

Hi @aralroca Thanks for your quick reply.

After more investigation, I found this workaround in another library. https://github.com/michchan/next-i18next-ssg-workaround/commit/0caac9e4b135f3e1ad6a528c7114467a79df5f21

With this new information, do you think it is possible to find a similar workaround with next-translate?

aralroca commented 3 years ago

@nativedone I don't know, sorry... As a workaround you can use a next-translate version below 0.19, in 0.19 we moved to Next.js i18n routing feature.

https://github.com/vinissimus/next-translate/tree/0.18.0

I know it's ugly, but it's the only easy way I can think of, you could use the CLI to build the pages with version 0.18 and use the next-translate API of the latest version. Maybe with an alias of the package.json you can keep both versions, or do copy&paste from the CLI...

This is the builder: https://github.com/vinissimus/next-translate/blob/0.18.0/cli/builder.js

nativedone commented 3 years ago

@aralroca It's not ideal but it very helpful for seeing possibilities. Thank you very much!