From 79f855d39a20074545597d48bbf7395bf5754de2 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sun, 22 Feb 2026 21:50:18 +0100 Subject: [PATCH] Add EnglishOnlyWarning component and display warning in relevant pages --- web/components/news/english-only-warning.tsx | 17 +++++++++++++++++ web/components/votes/vote-info.tsx | 3 +++ web/messages/de.json | 1 + web/messages/fr.json | 1 + web/pages/compatibility.tsx | 2 ++ web/pages/events.tsx | 2 ++ web/pages/news.tsx | 2 ++ web/pages/notifications.tsx | 2 ++ 8 files changed, 30 insertions(+) create mode 100644 web/components/news/english-only-warning.tsx diff --git a/web/components/news/english-only-warning.tsx b/web/components/news/english-only-warning.tsx new file mode 100644 index 00000000..ad18c6fe --- /dev/null +++ b/web/components/news/english-only-warning.tsx @@ -0,0 +1,17 @@ +import {useT} from 'web/lib/locale' +import {useLocale} from 'web/lib/locale' + +export function EnglishOnlyWarning() { + const t = useT() + const {locale} = useLocale() + + if (locale === 'en') { + return null + } + + return ( +

+ {t('news.note', 'Note: Unfortunately, this page is only available in English.')} +

+ ) +} diff --git a/web/components/votes/vote-info.tsx b/web/components/votes/vote-info.tsx index ea3602e4..613a3517 100644 --- a/web/components/votes/vote-info.tsx +++ b/web/components/votes/vote-info.tsx @@ -8,6 +8,7 @@ import toast from 'react-hot-toast' import {Button} from 'web/components/buttons/button' import {Col} from 'web/components/layout/col' import {Row} from 'web/components/layout/row' +import {EnglishOnlyWarning} from 'web/components/news/english-only-warning' import {Vote, VoteItem} from 'web/components/votes/vote-item' import {TextEditor, useTextEditor} from 'web/components/widgets/editor' import {Input} from 'web/components/widgets/input' @@ -124,6 +125,8 @@ export function VoteComponent() { )} + + {votes && votes.length > 0 && ( {votes.map((vote: Vote) => { diff --git a/web/messages/de.json b/web/messages/de.json index 9cb68137..4eef7193 100644 --- a/web/messages/de.json +++ b/web/messages/de.json @@ -365,6 +365,7 @@ "news.seo.description_general": "Alle Neuigkeiten und Code-Updates für Compass", "news.title": "Neuigkeiten", "news.view_on_github": "Auf GitHub ansehen", + "news.note": "Hinweis: Leider ist diese Seite nur auf Englisch verfügbar.", "notifications.empty": "Sie haben noch keine Benachrichtigungen.", "notifications.heading": "Wo möchten Sie benachrichtigt werden, wenn eine Person", "notifications.options.email": "Per E-Mail", diff --git a/web/messages/fr.json b/web/messages/fr.json index 5f674fa4..0684e7a6 100644 --- a/web/messages/fr.json +++ b/web/messages/fr.json @@ -367,6 +367,7 @@ "news.seo.description_general": "Toutes les actualités et mises à jour du code pour Compass", "news.title": "Quoi de neuf", "news.view_on_github": "Voir sur GitHub", + "news.note": "Note : Malheureusement, cette page n'est disponible qu'en anglais.", "notifications.empty": "Vous n'avez pas encore de notifications.", "notifications.heading": "Où voulez-vous être notifié lorsqu'une personne", "notifications.options.email": "Par e‑mail", diff --git a/web/pages/compatibility.tsx b/web/pages/compatibility.tsx index f83d7867..df1334a4 100644 --- a/web/pages/compatibility.tsx +++ b/web/pages/compatibility.tsx @@ -6,6 +6,7 @@ import {useCallback, useEffect, useMemo, useRef, useState} from 'react' import {CompatibilityAnswerBlock} from 'web/components/answers/compatibility-questions-display' import {Col} from 'web/components/layout/col' import {UncontrolledTabs} from 'web/components/layout/tabs' +import {EnglishOnlyWarning} from 'web/components/news/english-only-warning' import {PageBase} from 'web/components/page-base' import {SEO} from 'web/components/SEO' import {Input} from 'web/components/widgets/input' @@ -119,6 +120,7 @@ export default function CompatibilityPage() { setKeyword(e.target.value) }} /> + + {/* Upcoming Events */} {t('news.failed', 'Failed to fetch releases.')}

) : ( + {releases.map((release: Release) => (
diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index 0c1580d4..0959b2f0 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -3,6 +3,7 @@ import {type User} from 'common/src/user' import {Fragment, useEffect, useMemo, useState} from 'react' import {Col} from 'web/components/layout/col' import {UncontrolledTabs} from 'web/components/layout/tabs' +import {EnglishOnlyWarning} from 'web/components/news/english-only-warning' import {NoSEO} from 'web/components/NoSEO' import {NotificationItem} from 'web/components/notification-items' import {NotificationSettings} from 'web/components/notifications' @@ -23,6 +24,7 @@ export default function NotificationsPage() { {t('notifications.title', 'Updates')} +