-
Notifications
You must be signed in to change notification settings - Fork 0
Add localization for next.js #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module.exports = { | ||
| i18n: { | ||
| defaultLocale: "ru", | ||
| locales: ["ru", "en"], | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAvoid un-pinned - "@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.jsonLength of output: 512 Avoid un-pinned “latest” for Prisma – introduce deterministic, reproducible builds Locations to update:
Suggested diff: - "@prisma/client": "latest",
+ "@prisma/client": "^5.9.0",
…
- "prisma": "latest",
+ "prisma": "^5.9.0",Adjust 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| "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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Version incompatibility:
Failing to align these will surface at build time with 🤖 Prompt for AI Agents |
||||||||||||||||||||||
| "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", | ||||||||||||||||||||||
|
|
@@ -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" | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 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" | ||
| } |
| 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 |
|---|---|---|
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainPass the config object to -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 🏁 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.tsxLength of output: 906 Import and pass the Next-i18next config to To ensure the config is resolved correctly in ESM/monorepo setups (and on Netlify), explicitly import your • In 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 |
||
| import { ThemeProvider } from "styled-components"; | ||
|
|
||
|
|
@@ -24,4 +25,4 @@ const App: React.VoidFunctionComponent<AppProps & { err: Error }> = ({ | |
| ); | ||
| }; | ||
|
|
||
| export default App; | ||
| export default appWithTranslation(App); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n.localeCookieis not supported by Next configNext.js (≤ 13.5) validates
next.config.jsand fails on unknown keys.localeCookieis not part of the documentedi18nschema, so this block will either be ignored or throw duringnext build, breaking the pipeline.If you need custom cookie handling, move that logic to
middleware.tsor 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
🤖 Prompt for AI Agents