-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Issue #1657] Setup Next-Intl for App Pages #1851
Conversation
frontend/src/app/help/page.tsx
Outdated
return meta; | ||
} | ||
|
||
export default async function Help() { |
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.
You use useTransations()
and useMessages()
if it is a sync function.
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.
Believe all use*
hooks are typically only be used by client components (useSearchParams
, useEffect
, useState
). So its a bit weird to see next-intl
using them in server components https://next-intl-docs.vercel.app/docs/environments/server-client-components
frontend/src/app/help/page.tsx
Outdated
@@ -0,0 +1,54 @@ | |||
import { Metadata } from "next"; |
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.
This page was just for playing around, will delete.
627928b
to
9941fb8
Compare
This is green except for a single test for the
It is not a client component AFAICT, so not sure what the deal here is. |
a866c45
to
224d6a3
Compare
I console logged in Also wondering if AppLayout needs to be an async component? I'm not fully capacity at the moment but I should be able to help debug this better on Thursday if it's still an issue. |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 84.06% (+0.17% 🔼) |
870/1035 |
🟡 | Branches | 65.12% (+0.22% 🔼) |
224/344 |
🟡 | Functions | 75.57% (+0.22% 🔼) |
167/221 |
🟢 | Lines | 84.11% (+0.22% 🔼) |
810/963 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
---|---|---|---|---|---|
🟢 | ... / react-utils.tsx |
100% | 100% | 100% | 100% |
🟢 | src/i18n/config.ts | 87.5% | 100% | 100% | 100% |
🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
Test suite run success
166 tests passing in 55 suites.
Report generated by 🧪jest coverage report action from c090e9b
|
||
const BetaAlert = () => { | ||
const t = useTranslations("Beta_alert"); | ||
const heading = t.rich("alert_title", { |
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.
This file was added until #1361
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.
Should we add a comment in the code that points to that ticket? Format we've been using is // TODO (Issue #1361): ...
.
Same thing for AppLayout
file or other places
// TODO: Remove during move to app router and next-intl upgrade | ||
export default function Layout({ children, locale }: Props) { | ||
const t = useTranslations(); | ||
|
||
const header_strings = { |
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.
These strings will be removed once we moved the app router and are no longer using both i18n and next-intl in #1361
61ab471
to
3afbf5d
Compare
Met with @rylew1 , want to look more closely at how the browser locale works and how to only allow the selected locales in the routing layer. |
@rylew1 The PR does remove non language routes, I just had the |
Summary
Fixes #1657
Time to review: 30 mins
Changes proposed
Enables next-intl to enable translation for app pages. This sets up next-intl and enables it for the search page and app not found page. This adds one other app component. There are three which will be removed for #1361 .
Context for reviewers
The strings being declared and injected is still ugly and not addressed with this, but will be fixed with #1361 .
The
[locale]
folder has not been setup yet b/c it took over the full routing for the site. That folder will be setup in #1361 .