Translations aren't loaded while isFallback = true
See original GitHub issueHey!
I noticed an issue that translations aren’t loaded while in the isFallback state.
This is my getStaticPaths
for one of the pages:
export const getStaticPaths: GetStaticPaths = async ({ locales }) => {
const cities = await Api.getCities()
let paths: Path[] = []
locales?.forEach((locale) => {
const localePaths = cities.map((city) => ({
params: {
citySlug: city.slug,
},
locale,
}))
paths = paths.concat(localePaths)
})
return {
paths,
fallback: true,
}
getStaticProps
:
export const getStaticProps: GetStaticProps<Props, Params> = async ({
params,
}) => {
let notFound = false
if (!params || !params.citySlug) {
notFound = true
return {
notFound,
}
}
const home = await Api.getHome(params.citySlug)
const city = await Api.getSingleCity(params.citySlug)
if (!home || !city) {
notFound = true
}
return {
props: {
home,
city,
},
notFound,
revalidate: 60,
}
}
So when the new props are being fetched (isFallback is true), the translations aren’t loaded. Once isFallback is false, then you can see all the translations.
For now, I’m just setting if (isFallback) return null - so that the screen is white while in fallback, but this is not that user friendly 😦
Do you guys have any ideas on how to fix that?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Translations aren't loaded while isFallback = true #575 - GitHub
I noticed an issue that translations aren't loaded while in the isFallback state. This is my getStaticPaths for one of the pages: export...
Read more >NextJS: Failed when fallback set to true - Stack Overflow
Inside your /clip/[player]/[id].js file, you need to handle the fallback state when that page is being requested on-demand.
Read more >Load balancing across backend servers | Apigee X
When target1 and target2 are unavailable, all traffic is routed to target3 . Path. Path defines a URI fragment that will be appended...
Read more >Add or Load Translations - i18next documentation
If you want to lazy load some translations via a backend plugin, you may need to use the partialBundledLanguages: true option. This allows...
Read more >Database Administration Manual - Global Title Translation
or class0, load sharing for all Class 1 SCCP messages is supported only in the dominant mode. If the messages are not in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Digging through the commits since 1.0.5, I was able to pin-point the issue down to https://github.com/vinissimus/next-translate/blob/8abc45855cdc95bed873657379499c758483829a/src/useTranslation.tsx#L11
useMemo()
has the wrong dependencies.ctx.t
should be listed in the deps instead ofctx.lang
.@aralroca Can you change it and release a hotfix patch version or should I create a PR?
But for my page, the required translation is just under
common
namespace , and i did added'*': ['common']
in 18n.js . Also the translation only missing when go to page directly (paste the link to browser and press enter), if I navigate inside the website and land into the not found page, the translation will display correctly .