Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions next-i18next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
i18n: {
defaultLocale: "ru",
locales: ["ru", "en"],
},
};
12 changes: 12 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ const nextConfig = {
compiler: {
styledComponents: true,
},
i18n: {
defaultLocale: "ru",
locales: ["ru", "en"],
localeDetection: false, // отключить автоопределение по Accept-Language
localeCookie: {
name: "django_language",
httpOnly: false,
sameSite: false, // Django uses None, Next.js uses false for None
path: "/",
secure: false, // same as Django DEBUG mode
},
},
Comment on lines +24 to +35
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

i18n.localeCookie is not supported by Next config

Next.js (≤ 13.5) validates next.config.js and fails on unknown keys.
localeCookie is not part of the documented i18n schema, so this block will either be ignored or throw during next build, breaking the pipeline.

If you need custom cookie handling, move that logic to middleware.ts or your own server layer and drop the unsupported field:

   i18n: {
     defaultLocale: "ru",
     locales: ["ru", "en"],
     localeDetection: false,
-    localeCookie: {
-      name: "django_language",
-      httpOnly: false,
-      sameSite: false,
-      path: "/",
-      secure: false,
-    },
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
i18n: {
defaultLocale: "ru",
locales: ["ru", "en"],
localeDetection: false, // отключить автоопределение по Accept-Language
localeCookie: {
name: "django_language",
httpOnly: false,
sameSite: false, // Django uses None, Next.js uses false for None
path: "/",
secure: false, // same as Django DEBUG mode
},
},
i18n: {
defaultLocale: "ru",
locales: ["ru", "en"],
localeDetection: false, // отключить автоопределение по Accept-Language
},
🤖 Prompt for AI Agents
In next.config.mjs around lines 24 to 35, the i18n.localeCookie configuration is
not supported by Next.js and will cause build failures. Remove the entire
localeCookie block from the i18n config. If custom cookie handling is required,
implement that logic separately in middleware.ts or your server code instead of
placing it in next.config.mjs.


productionBrowserSourceMaps: true,
reactStrictMode: true,
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,22 @@
"@fortawesome/free-brands-svg-icons": "^6.0.0",
"@fortawesome/free-solid-svg-icons": "^6.0.0",
"@fortawesome/react-fontawesome": "^0.1.17",
"@prisma/client": "^3.9.2",
"@prisma/client": "latest",
"@sentry/nextjs": "^6.17.9",
Comment on lines +35 to 36
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Avoid un-pinned "latest" for Prisma – introduces non-deterministic builds
Using "latest" for both @prisma/client and prisma means every fresh install can silently pick up a new major version and break your compiled client or schema workflow. Pin to an explicit semver range you’ve verified.

-    "@prisma/client": "latest",
+    "@prisma/client": "^5.9.0",-    "prisma": "latest",
+    "prisma": "^5.9.0",

Also applies to: 84-85


🏁 Script executed:

#!/bin/bash
# Verify use of un-pinned “latest” for Prisma packages
echo "@prisma/client version in dependencies:"
jq -r '.dependencies["@prisma/client"] // "not found"' package.json
echo "prisma version in devDependencies:"
jq -r '.devDependencies["prisma"] // "not found"' package.json
echo "All occurrences of “latest” in package.json:"
rg -n '"latest"' -n package.json

Length of output: 512


Avoid un-pinned “latest” for Prisma – introduce deterministic, reproducible builds
Using "latest" for both @prisma/client and prisma means any fresh install can pull in a new major release and silently break your generated client or migration workflow. Pin each to an explicit, tested semver range.

Locations to update:

  • package.json – Line 35: "@prisma/client": "latest"
  • package.json – Line 84: "prisma": "latest"

Suggested diff:

-    "@prisma/client": "latest",
+    "@prisma/client": "^5.9.0",-    "prisma": "latest",
+    "prisma": "^5.9.0",

Adjust ^5.9.0 to whichever patch/minor you’ve verified in your CI before merging.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@prisma/client": "latest",
"@sentry/nextjs": "^6.17.9",
// … in your "dependencies" section around line 35 …
"@prisma/client": "^5.9.0",
"@sentry/nextjs": "^6.17.9",
// … other dependencies …
// … in your "devDependencies" section around line 84 …
"prisma": "^5.9.0",
// … other devDependencies …
🤖 Prompt for AI Agents
In package.json at lines 35 and 84, the dependencies "@prisma/client" and
"prisma" are set to "latest", which can cause unpredictable builds. Replace
"latest" with a specific semver version range, such as "^5.9.0" or the exact
version verified in your CI, to ensure deterministic and reproducible builds.

"date-fns": "^2.28.0",
"dayjs": "^1.10.7",
"gravatar-url": "^4.0.1",
"i18next": "^25.3.2",
"lru-cache": "^7.4.0",
"mobx": "^6.4.0",
"mobx-devtools-mst": "^0.9.30",
"mobx-react": "^7.3.0",
"mobx-state-tree": "^5.1.3",
"next": "^12.1.0",
"next-i18next": "^15.4.2",
"react": "^17.0.2",
Comment on lines +40 to 48
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Version incompatibility: next-i18next@15 requires Next ≥ 13.4 but project is on 12.1
next-i18next v15 moved to Next.js’ App Router and relies on features that do not exist in Next 12. Either:

  1. Upgrade next (and React) to a compatible version,
  2. or downgrade next-i18next to ≤ 13.x.

Failing to align these will surface at build time with Module not found/appDir errors.

🤖 Prompt for AI Agents
In package.json around lines 40 to 48, the version of next-i18next (15.4.2)
requires Next.js version 13.4 or higher, but the project currently uses Next
12.1. To fix this, either upgrade the next dependency to at least 13.4 along
with a compatible React version, or downgrade next-i18next to version 13.x or
lower to maintain compatibility and avoid build errors related to missing
modules or appDir features.

"react-dom": "^17.0.2",
"react-i18next": "^15.6.1",
"react-linkify": "^1.0.0-alpha",
"react-redux": "^7.2.6",
"react-tooltip": "^4.2.21",
Expand Down Expand Up @@ -78,7 +81,7 @@
"prettier-plugin-packagejson": "^2.2.15",
"prettier-plugin-prisma": "^3.9.0",
"prettier-plugin-sh": "^0.8.1",
"prisma": "^3.9.2",
"prisma": "latest",
"suppress-exit-code": "^1.0.0",
"typescript": "^4.5.5"
},
Expand Down
7 changes: 7 additions & 0 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"welcome": "Welcome",
"dataPeriod": "Data Period",
"forPeriod": "For period:",
"filters": "Filters",
"hide": "Hide"
}
7 changes: 7 additions & 0 deletions public/locales/ru/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"welcome": "Добро пожаловать",
"dataPeriod": "Период данных",
"forPeriod": "За период:",
"filters": "Фильтры",
"hide": "Скрыть"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { observer } from "mobx-react";
import { useTranslation } from "next-i18next";
import * as React from "react";

import { useStore } from "../../models/root-store";
Expand Down Expand Up @@ -65,6 +66,7 @@ const CategoryTag = observer(({ filter }) => {
export const FilterPanelNormal = observer(() => {
const { filterStore } = useStore();
const { filters } = filterStore;
const { t } = useTranslation("common");

const mainFilters = filters.filter(
(currentFilter) => currentFilter.name !== "category",
Expand All @@ -83,7 +85,7 @@ export const FilterPanelNormal = observer(() => {
</div>
))}
<div className="filter-item">
<p className="subtitle2">Фильтры</p>
<p className="subtitle2">{t("filters")}</p>
<div className="category-filter">
{categoryFilters.map((currentFilter) => (
<CategoryTag key={currentFilter.key} filter={currentFilter} />
Expand All @@ -100,7 +102,7 @@ export const FilterPanelNormal = observer(() => {
<svg className="icon icon-arrow-up">
<use xlinkHref="/static/media/svg/sprite.svg#arrow-up" />
</svg>
<span>Скрыть</span>
<span>{t("hide")}</span>
</button>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "../styles/inherited-scss/style.scss";

import { UserProvider } from "@auth0/nextjs-auth0";
import { AppProps } from "next/app";
import { appWithTranslation } from "next-i18next";
import * as React from "react";
Comment on lines +5 to 6
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Pass the config object to appWithTranslation to ensure SSR parity
next-i18next looks for the config via CJS require, which fails in some ESM/monorepo setups and on Netlify. Importing and passing the config makes the linkage explicit.

-import { appWithTranslation } from "next-i18next";
+import { appWithTranslation } from "next-i18next";
+import nextI18NextConfig from "../../next-i18next.config.js";-export default appWithTranslation(App);
+export default appWithTranslation(App, nextI18NextConfig);

Also applies to: 28-28


I’ll verify whether a next-i18next.config file exists and inspect how appWithTranslation is currently being invoked.


🏁 Script executed:

#!/bin/bash
# Locate the i18next config file
fd next-i18next.config.* --max-depth 2

# Show the top of _app.tsx to see current imports and usage
sed -n '1,80p' src/pages/_app.tsx

Length of output: 906


Import and pass the Next-i18next config to appWithTranslation

To ensure the config is resolved correctly in ESM/monorepo setups (and on Netlify), explicitly import your next-i18next.config.js and pass it into appWithTranslation.

• In src/pages/_app.tsx, add:

import nextI18NextConfig from "../../next-i18next.config.js";

• Replace the default export on line 28:

- export default appWithTranslation(App);
+ export default appWithTranslation(App, nextI18NextConfig);

This makes the CJS→ESM linkage explicit and avoids SSR parity issues.

🤖 Prompt for AI Agents
In src/pages/_app.tsx around lines 5 to 6, import the next-i18next configuration
explicitly by adding "import nextI18NextConfig from
'../../next-i18next.config.js';" and then update the default export on line 28
to pass this config into appWithTranslation, i.e., use appWithTranslation(MyApp,
nextI18NextConfig). This ensures proper config resolution in ESM/monorepo
environments and prevents SSR parity issues.

import { ThemeProvider } from "styled-components";

Expand All @@ -24,4 +25,4 @@ const App: React.VoidFunctionComponent<AppProps & { err: Error }> = ({
);
};

export default App;
export default appWithTranslation(App);
11 changes: 11 additions & 0 deletions src/pages/iframes/map.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { NextPage } from "next";
import dynamic from "next/dynamic";
import Script from "next/script";
import { useTranslation } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import * as React from "react";

import { usePostLocationSearchChangesToIframeParent } from "../../shared/django-helpers";
Expand All @@ -13,6 +15,7 @@ const InheritedMap = dynamic(

const MapIframePage: NextPage = () => {
usePostLocationSearchChangesToIframeParent();
const { t } = useTranslation("common");

return (
<>
Expand All @@ -29,4 +32,12 @@ const MapIframePage: NextPage = () => {
);
};

export async function getServerSideProps({ locale }: { locale: string }) {
return {
props: {
...(await serverSideTranslations(locale ?? "ru", ["common"])),
},
};
}

export default MapIframePage;
Loading
Loading