aralroca / next-translate-plugin

Next-translate plugin for i18n in Next.js 🌍 - Load page translations and use them in an easy way!
MIT License
30 stars 17 forks source link

feat: add basePath as config option #55

Open myabeaver opened 1 year ago

myabeaver commented 1 year ago

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update [ ] Bug fix [x] New feature [ ] Other, please explain:

What changes did you make? (Give an overview)

aralroca commented 1 year ago

@myasteiner ping 🏓 🤗

laneme commented 1 year ago

:hugs: :ping_pong:

mkbctrl commented 1 year ago

Is it possible to takeover?

aralroca commented 1 year ago

Is it possible to takeover?

when the changes I have mentioned in the comments have been made. If we see that @myasteiner does not have time, we would implement it in another PR.

myabeaver commented 1 year ago

Sorry, I would do that if the coming weeks I've nobody has time before.

myabeaver commented 1 year ago

Is it possible to takeover?

when the changes I have mentioned in the comments have been made. If we see that @myasteiner does not have time, we would implement it in another PR.

I've updated the PR does it look good for you? Btw, can we maybe also add an option to opt-out of getStaticProps per default? @aralroca

jporsay commented 11 months ago

Hey @aralroca , would you mind taking a look at this PR? This is something that's a blocker for upgrading dependencies which bring very nice additions :)

webpro commented 11 months ago

For the time being, I've released @webpro/next-translate-plugin@2.6.3. Example CJS usage:

nextTranslate({ nextTranslate: { basePath: __dirname } })

Note that I've changed the implementation a bit compared to this PR (so you can pass the basePath and it won't be touched):

  let basePath =
    nextTranslate.basePath ??
    path.resolve(
      path.relative(pkgDir(), process.env.NEXT_TRANSLATE_PATH || '.')
    )