Comments (6)
@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.
@maksymdukov async function
syntax should work in 0.13.0-canary.2
👍
from next-translate.
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.
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.
@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.
Good catch!! Thanks, this should be fixed before 0.13.0
release! Thanks!
from next-translate.
Related Issues (20)
- next-translate-plugin breaks SSG in app router HOT 7
- App Router - Default locale without it's name on url HOT 2
- TypeError: Cannot read properties of undefined (reading 'loadLocaleFrom') HOT 1
- Locale slug is added to api and other routes outside of app dir
- AppDirI18nProvider is not loaded after refresh, so lang is null HOT 2
- Change language without modifying the URL (/[lang]/rest) HOT 4
- add Dependabot HOT 1
- Next.js app build fails due to empty lang value HOT 3
- change "Twitter" shields badge to "𝕏 " in README.md
- 404 error pages with next 14 HOT 20
- Localizations not working in prod bundle on NextJs 14 HOT 1
- Buildng project using only app router HOT 9
- Translation not working on client component inside layout HOT 10
- Warning: Detected multiple renderers concurrently rendering the same context provider.
- 404 when accssing homepage HOT 7
- 404 on root when using baseURL in vercel HOT 1
- Can't resolve 'next-translate/appWithI18n' on 2.7.0-canary.1 HOT 6
- Cold Start on dynamic routes HOT 5
- Type safety for getT function
- Regular locale naming like "en" breaks the i18n config HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-translate.