Code Monkey home page Code Monkey logo

Comments (6)

maksymdukov avatar maksymdukov commented on May 19, 2024 1

@aralroca
Wow, that was fast.
It works, many thanks. :)

However there's one rare case which regexp in hasSpecialMethod doesn't cover:
export async function getStaticProps() {}

from next-translate.

aralroca avatar aralroca commented on May 19, 2024 1

@maksymdukov async function syntax should work in 0.13.0-canary.2 👍

from next-translate.

aralroca avatar aralroca commented on May 19, 2024

I'm not sure about some hack, but I guess that is not possible, at least right now.

However, I think that we should change our way to do the build in the CLI in order to provide it, using dynamic routes with [lang]. After that, it should be possible to get the current language via params.

Thank @maksymdukov to report this! This will be very useful for 0.13.0 release 🙂

from next-translate.

aralroca avatar aralroca commented on May 19, 2024

When this issue will be solved vercel/next.js#11309 it will be trivial to wrap the lang to getStaticProps & getServerSideProps 🤞 Meanwhile, I'm going to investigate if there is another way to handle this!

from next-translate.

aralroca avatar aralroca commented on May 19, 2024

@maksymdukov from now on, the lang will be available on getStaticProps, getStaticProps and getServerSideProps.

I'm going to explain it better in the docs for 0.13.0 version. But a simple example:

export function getStaticProps({ lang }){
   return { props: { data: getDataFromLang(lang) } }
}

The 0.13.0 release will be available soon. However, I released the 0.13.0-canary.1 with that feature. Please, confirm that 0.13.0-canary.1 works in your case 👏!

https://github.com/vinissimus/next-translate/releases/tag/0.13.0-canary.1

from next-translate.

aralroca avatar aralroca commented on May 19, 2024

Good catch!! Thanks, this should be fixed before 0.13.0 release! Thanks!

from next-translate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.