question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No translations for routes using getServerSideProps

See original GitHub issue

🐛 Bug Report

Nothing is being translated for any routes deployed to Vercel that are using getServerSideProps, they are however working fine for SSG. Everything is working as expected locally.

image

To Reproduce

next-i18next.config.js

const path = require("path");

module.exports = {
  i18n: {
    defaultLocale: "en",
    locales: ["en", "de", "fr"],
    reloadOnPrerender: process.env.NODE_ENV === "development",
  },
  localePath: path.resolve("./public/locales"),
};

pages/profile.tsx

export const getServerSideProps: GetServerSideProps =>
    ...
    return {
      props: {
        ... ,
        ...(await serverSideTranslations(locale!, ["common", "profile"])),
      },
    };
  },
});

const Profile = (
  context: InferGetServerSidePropsType<typeof getServerSideProps>
) => {
  const { t } = useTranslation("profile");
...

Expected behavior

Expected resolution of a key when using t("key")

Your Environment

  • runtime version: v14
  • i18next version: ^12.0.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
c-schobercommented, Aug 31, 2022

Upgrade to the newest Next version and next-i18next version still leads to not found translations for us on catch all routes when deploying with vercel. Seems like that vercel changed some parts of their architecture.

1reaction
FBoslercommented, Aug 30, 2022

+1 this, We have been seeing similar behaviour since yesterday around 15:00

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessing pathname in getServerSideProps #18885 - GitHub
Translating non dynamic route segments: pages/search.js should be accessible on example.es/buscar (es) and example.co.uk/search (en).
Read more >
Advanced Features: Internationalized Routing - Next.js
Next.js has built-in support for internationalized (i18n) routing since v10.0.0 . You can provide a list of locales, the default locale, and domain-specific ......
Read more >
How to access locale in custom app on server-side in Next.js?
You can access the locale in your custom app's getInitialProps through the router prop. static async getInitialProps({ Component, ctx, ...
Read more >
All side optimized Next.js translations - DEV Community ‍ ‍
This happens if you're using the internationalized routing feature and are trying to generate a static HTML export by executing next export ....
Read more >
next-translate-routes - npm
Flexible and translated routes for Next.js without custom server. Latest version: 1.9.1, last published: a month ago. Start using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found