From 8037bb5169a4da00eb672043f1b9e0bee916d42e Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Sun, 2 Mar 2025 13:07:00 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Remove=20references=20?= =?UTF-8?q?to=20next-i18next?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/landing/package.json | 1 - apps/landing/src/app/[locale]/footer.tsx | 3 +- apps/landing/src/components/error-page.tsx | 3 +- apps/landing/src/components/home/hero.tsx | 2 +- apps/landing/src/components/marketing.tsx | 2 +- .../{client.tsx => client/i18n-provider.tsx} | 13 ++------ apps/landing/src/i18n/client/index.ts | 3 ++ .../src/{components => i18n/client}/trans.tsx | 3 +- .../src/i18n/client/use-translation.ts | 6 ++++ apps/landing/src/utils/page-translations.ts | 16 --------- apps/web/package.json | 1 - .../(admin)/settings/profile/profile-page.tsx | 2 +- .../poll/[urlId]/edit-options/page.tsx | 2 +- .../poll/[urlId]/guest-poll-alert.tsx | 2 +- .../src/components/discussion/discussion.tsx | 2 +- apps/web/src/components/error-page.tsx | 3 +- apps/web/src/components/feedback.tsx | 2 +- .../components/forms/poll-details-form.tsx | 2 +- .../date-navigation-toolbar.tsx | 2 +- .../month-calendar/month-calendar.tsx | 2 +- .../poll-options-form/poll-options-form.tsx | 3 +- .../src/components/new-participant-modal.tsx | 2 +- .../src/components/participant-dropdown.tsx | 2 +- apps/web/src/components/poll-context.tsx | 2 +- apps/web/src/components/poll/desktop-poll.tsx | 2 +- .../desktop-poll/participant-row-form.tsx | 2 +- .../poll/manage-poll/finalize-poll-dialog.tsx | 2 +- .../poll/manage-poll/use-csv-exporter.ts | 2 +- apps/web/src/components/poll/mobile-poll.tsx | 2 +- .../components/poll/notifications-toggle.tsx | 2 +- apps/web/src/components/pro-badge.tsx | 2 +- .../settings/language-preference.tsx | 2 +- apps/web/src/components/steps/steps.tsx | 2 +- .../time-zone-picker/time-zone-select.tsx | 2 +- apps/web/src/components/upgrade-button.tsx | 2 +- apps/web/src/utils/form-validation.ts | 2 +- yarn.lock | 33 ++----------------- 37 files changed, 47 insertions(+), 91 deletions(-) rename apps/landing/src/i18n/{client.tsx => client/i18n-provider.tsx} (75%) create mode 100644 apps/landing/src/i18n/client/index.ts rename apps/landing/src/{components => i18n/client}/trans.tsx (73%) create mode 100644 apps/landing/src/i18n/client/use-translation.ts delete mode 100644 apps/landing/src/utils/page-translations.ts diff --git a/apps/landing/package.json b/apps/landing/package.json index 1e8a6744a1e..26c8d7bd8d9 100644 --- a/apps/landing/package.json +++ b/apps/landing/package.json @@ -28,7 +28,6 @@ "intl-messageformat": "^10.3.4", "lodash": "^4.17.21", "nanoid": "^5.0.9", - "next-i18next": "^13.0.3", "next-mdx-remote": "^5.0.0", "next-seo": "^6.1.0", "react-i18next": "^15.4.1", diff --git a/apps/landing/src/app/[locale]/footer.tsx b/apps/landing/src/app/[locale]/footer.tsx index 29dfc0b2271..1960844977d 100644 --- a/apps/landing/src/app/[locale]/footer.tsx +++ b/apps/landing/src/app/[locale]/footer.tsx @@ -20,9 +20,8 @@ import Image from "next/image"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import * as React from "react"; -import { useTranslation } from "react-i18next"; -import { Trans } from "@/components/trans"; +import { Trans, useTranslation } from "@/i18n/client"; const LanguageSelect = () => { const router = useRouter(); diff --git a/apps/landing/src/components/error-page.tsx b/apps/landing/src/components/error-page.tsx index 2a2255bba48..0201b914629 100644 --- a/apps/landing/src/components/error-page.tsx +++ b/apps/landing/src/components/error-page.tsx @@ -3,9 +3,10 @@ import { Button } from "@rallly/ui/button"; import { FileSearchIcon } from "lucide-react"; import Link from "next/link"; -import { useTranslation } from "next-i18next"; import * as React from "react"; +import { useTranslation } from "@/i18n/client"; + export interface ComponentProps { icon?: React.ReactNode; title: string; diff --git a/apps/landing/src/components/home/hero.tsx b/apps/landing/src/components/home/hero.tsx index e80090c651e..8abe377565f 100644 --- a/apps/landing/src/components/home/hero.tsx +++ b/apps/landing/src/components/home/hero.tsx @@ -8,7 +8,7 @@ import Image from "next/image"; import Link from "next/link"; import * as React from "react"; -import { Trans } from "@/components/trans"; +import { Trans } from "@/i18n/client/trans"; import { handwritten } from "@/fonts/handwritten"; import { linkToApp } from "@/lib/linkToApp"; diff --git a/apps/landing/src/components/marketing.tsx b/apps/landing/src/components/marketing.tsx index 263018d39c8..af6daa2e9cb 100644 --- a/apps/landing/src/components/marketing.tsx +++ b/apps/landing/src/components/marketing.tsx @@ -5,7 +5,7 @@ import Image from "next/image"; import Link from "next/link"; import React from "react"; -import { Trans } from "@/components/trans"; +import { Trans } from "@/i18n/client/trans"; // export const UsedBy = () => { // return ( diff --git a/apps/landing/src/i18n/client.tsx b/apps/landing/src/i18n/client/i18n-provider.tsx similarity index 75% rename from apps/landing/src/i18n/client.tsx rename to apps/landing/src/i18n/client/i18n-provider.tsx index 37f71c9b6a5..f9a9eba29bf 100644 --- a/apps/landing/src/i18n/client.tsx +++ b/apps/landing/src/i18n/client/i18n-provider.tsx @@ -1,17 +1,12 @@ "use client"; -import type { Namespace } from "i18next"; import i18next from "i18next"; import ICU from "i18next-icu"; import resourcesToBackend from "i18next-resources-to-backend"; import React from "react"; -import { - I18nextProvider, - initReactI18next, - useTranslation as useTranslationOrg, -} from "react-i18next"; +import { I18nextProvider, initReactI18next } from "react-i18next"; import { useAsync } from "react-use"; -import { defaultNS, getOptions } from "./settings"; +import { defaultNS, getOptions } from "../settings"; async function initTranslations(lng: string) { const i18n = i18next @@ -28,10 +23,6 @@ async function initTranslations(lng: string) { return i18n; } -export function useTranslation(ns?: Namespace) { - return useTranslationOrg(ns); -} - export function I18nProvider({ locale, children, diff --git a/apps/landing/src/i18n/client/index.ts b/apps/landing/src/i18n/client/index.ts new file mode 100644 index 00000000000..32fbf2cb29a --- /dev/null +++ b/apps/landing/src/i18n/client/index.ts @@ -0,0 +1,3 @@ +export * from "./i18n-provider"; +export * from "./trans"; +export * from "./use-translation"; diff --git a/apps/landing/src/components/trans.tsx b/apps/landing/src/i18n/client/trans.tsx similarity index 73% rename from apps/landing/src/components/trans.tsx rename to apps/landing/src/i18n/client/trans.tsx index c06b5105188..eb5450d5d6a 100644 --- a/apps/landing/src/components/trans.tsx +++ b/apps/landing/src/i18n/client/trans.tsx @@ -1,4 +1,5 @@ -import { Trans as BaseTrans, useTranslation } from "next-i18next"; +"use client"; +import { Trans as BaseTrans, useTranslation } from "react-i18next"; type TransWithContextProps = Omit, "t">; diff --git a/apps/landing/src/i18n/client/use-translation.ts b/apps/landing/src/i18n/client/use-translation.ts new file mode 100644 index 00000000000..2e8e95c083b --- /dev/null +++ b/apps/landing/src/i18n/client/use-translation.ts @@ -0,0 +1,6 @@ +import type { Namespace } from "i18next"; +import { useTranslation as useTranslationOrg } from "react-i18next"; + +export function useTranslation(ns?: Namespace) { + return useTranslationOrg(ns); +} diff --git a/apps/landing/src/utils/page-translations.ts b/apps/landing/src/utils/page-translations.ts deleted file mode 100644 index b3a3a066ea0..00000000000 --- a/apps/landing/src/utils/page-translations.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { GetStaticProps } from "next"; -import { serverSideTranslations } from "next-i18next/serverSideTranslations"; - -export const getStaticTranslations = - (namespacesRequired: string[] = []): GetStaticProps => - async (ctx) => { - const locale = ctx.locale ?? "en"; - return { - props: { - ...(await serverSideTranslations(locale, [ - "common", - ...namespacesRequired, - ])), - }, - }; - }; diff --git a/apps/web/package.json b/apps/web/package.json index 46e0e458cb4..612b307a3e1 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -69,7 +69,6 @@ "micro": "^10.0.1", "nanoid": "^5.0.9", "next-auth": "^5.0.0-beta.25", - "next-i18next": "^13.0.3", "php-serialize": "^4.1.1", "postcss": "^8.4.31", "react-big-calendar": "^1.8.1", diff --git a/apps/web/src/app/[locale]/(admin)/settings/profile/profile-page.tsx b/apps/web/src/app/[locale]/(admin)/settings/profile/profile-page.tsx index f3040aaba9b..4996ddef1bb 100644 --- a/apps/web/src/app/[locale]/(admin)/settings/profile/profile-page.tsx +++ b/apps/web/src/app/[locale]/(admin)/settings/profile/profile-page.tsx @@ -3,7 +3,6 @@ import { Button } from "@rallly/ui/button"; import { DialogTrigger } from "@rallly/ui/dialog"; import { LogOutIcon, TrashIcon } from "lucide-react"; import Head from "next/head"; -import { useTranslation } from "next-i18next"; import { DeleteAccountDialog } from "@/app/[locale]/(admin)/settings/profile/delete-account-dialog"; import { ProfileSettings } from "@/app/[locale]/(admin)/settings/profile/profile-settings"; @@ -15,6 +14,7 @@ import { } from "@/components/settings/settings"; import { Trans } from "@/components/trans"; import { useUser } from "@/components/user-provider"; +import { useTranslation } from "@/i18n/client"; import { ProfileEmailAddress } from "./profile-email-address"; diff --git a/apps/web/src/app/[locale]/poll/[urlId]/edit-options/page.tsx b/apps/web/src/app/[locale]/poll/[urlId]/edit-options/page.tsx index ad9b20964f7..899c9b2a621 100644 --- a/apps/web/src/app/[locale]/poll/[urlId]/edit-options/page.tsx +++ b/apps/web/src/app/[locale]/poll/[urlId]/edit-options/page.tsx @@ -5,7 +5,6 @@ import { Form } from "@rallly/ui/form"; import dayjs from "dayjs"; import Link from "next/link"; import { useRouter } from "next/navigation"; -import { useTranslation } from "next-i18next"; import { useForm } from "react-hook-form"; import type { PollOptionsData } from "@/components/forms"; @@ -14,6 +13,7 @@ import { useModalContext } from "@/components/modal/modal-provider"; import { useUpdatePollMutation } from "@/components/poll/mutations"; import { usePoll } from "@/components/poll-context"; import { Trans } from "@/components/trans"; +import { useTranslation } from "@/i18n/client"; import { encodeDateOption } from "@/utils/date-time-utils"; const convertOptionToString = ( diff --git a/apps/web/src/app/[locale]/poll/[urlId]/guest-poll-alert.tsx b/apps/web/src/app/[locale]/poll/[urlId]/guest-poll-alert.tsx index 0d6999663ee..f3693fd277c 100644 --- a/apps/web/src/app/[locale]/poll/[urlId]/guest-poll-alert.tsx +++ b/apps/web/src/app/[locale]/poll/[urlId]/guest-poll-alert.tsx @@ -1,10 +1,10 @@ "use client"; import { Alert, AlertDescription, AlertTitle } from "@rallly/ui/alert"; import { InfoIcon } from "lucide-react"; -import { Trans } from "next-i18next"; import { LoginLink } from "@/components/login-link"; import { RegisterLink } from "@/components/register-link"; +import { Trans } from "@/components/trans"; import { useUser } from "@/components/user-provider"; import { usePoll } from "@/contexts/poll"; diff --git a/apps/web/src/components/discussion/discussion.tsx b/apps/web/src/components/discussion/discussion.tsx index 5719f3a8908..e338dfa9fd0 100644 --- a/apps/web/src/components/discussion/discussion.tsx +++ b/apps/web/src/components/discussion/discussion.tsx @@ -27,7 +27,7 @@ import { TrashIcon, } from "lucide-react"; import { signIn, useSession } from "next-auth/react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import * as React from "react"; import { Controller, useForm } from "react-hook-form"; diff --git a/apps/web/src/components/error-page.tsx b/apps/web/src/components/error-page.tsx index 83ad7724c79..eba75da9130 100644 --- a/apps/web/src/components/error-page.tsx +++ b/apps/web/src/components/error-page.tsx @@ -1,9 +1,10 @@ import { Button } from "@rallly/ui/button"; import { FrownIcon } from "lucide-react"; import Link from "next/link"; -import { useTranslation } from "next-i18next"; import * as React from "react"; +import { useTranslation } from "@/i18n/client"; + export interface ComponentProps { icon?: React.ComponentType<{ className?: string }>; title: string; diff --git a/apps/web/src/components/feedback.tsx b/apps/web/src/components/feedback.tsx index 62749b9d9f6..ea56cb1ec94 100644 --- a/apps/web/src/components/feedback.tsx +++ b/apps/web/src/components/feedback.tsx @@ -14,7 +14,7 @@ import { SmileIcon, } from "lucide-react"; import Link from "next/link"; -import { Trans } from "next-i18next"; +import { Trans } from "@/components/trans"; const FeedbackButton = () => { return ( diff --git a/apps/web/src/components/forms/poll-details-form.tsx b/apps/web/src/components/forms/poll-details-form.tsx index 8d634e22c11..b1844e7e0d6 100644 --- a/apps/web/src/components/forms/poll-details-form.tsx +++ b/apps/web/src/components/forms/poll-details-form.tsx @@ -1,7 +1,7 @@ import { FormField, FormItem, FormLabel, FormMessage } from "@rallly/ui/form"; import { Input } from "@rallly/ui/input"; import { Textarea } from "@rallly/ui/textarea"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import { useFormContext } from "react-hook-form"; import { Trans } from "@/components/trans"; diff --git a/apps/web/src/components/forms/poll-options-form/date-navigation-toolbar.tsx b/apps/web/src/components/forms/poll-options-form/date-navigation-toolbar.tsx index a8b50f0ae7c..121527d28de 100644 --- a/apps/web/src/components/forms/poll-options-form/date-navigation-toolbar.tsx +++ b/apps/web/src/components/forms/poll-options-form/date-navigation-toolbar.tsx @@ -1,6 +1,6 @@ import { Button } from "@rallly/ui/button"; import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import * as React from "react"; export interface DateNavigationToolbarProps { diff --git a/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx b/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx index 35e876f9382..8eaa18789dd 100644 --- a/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx +++ b/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx @@ -19,7 +19,7 @@ import { SparklesIcon, XIcon, } from "lucide-react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import * as React from "react"; import { useFormContext } from "react-hook-form"; diff --git a/apps/web/src/components/forms/poll-options-form/poll-options-form.tsx b/apps/web/src/components/forms/poll-options-form/poll-options-form.tsx index f030581eab4..d26590bdef6 100644 --- a/apps/web/src/components/forms/poll-options-form/poll-options-form.tsx +++ b/apps/web/src/components/forms/poll-options-form/poll-options-form.tsx @@ -16,11 +16,12 @@ import { Switch } from "@rallly/ui/switch"; import { Tabs, TabsList, TabsTrigger } from "@rallly/ui/tabs"; import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip"; import { CalendarIcon, GlobeIcon, InfoIcon, TableIcon } from "lucide-react"; -import { Trans, useTranslation } from "next-i18next"; import * as React from "react"; import { useFormContext } from "react-hook-form"; import { TimeZoneCommand } from "@/components/time-zone-picker/time-zone-select"; +import { Trans } from "@/components/trans"; +import { useTranslation } from "@/i18n/client"; import { getBrowserTimeZone } from "../../../utils/date-time-utils"; import type { NewEventData } from "../types"; diff --git a/apps/web/src/components/new-participant-modal.tsx b/apps/web/src/components/new-participant-modal.tsx index 83cbb521bce..985146eaf51 100644 --- a/apps/web/src/components/new-participant-modal.tsx +++ b/apps/web/src/components/new-participant-modal.tsx @@ -7,7 +7,7 @@ import { FormMessage } from "@rallly/ui/form"; import { Input } from "@rallly/ui/input"; import * as Sentry from "@sentry/nextjs"; import { TRPCClientError } from "@trpc/client"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import { useForm } from "react-hook-form"; import z from "zod"; diff --git a/apps/web/src/components/participant-dropdown.tsx b/apps/web/src/components/participant-dropdown.tsx index e1fd648f8d7..2129d61dbc0 100644 --- a/apps/web/src/components/participant-dropdown.tsx +++ b/apps/web/src/components/participant-dropdown.tsx @@ -29,7 +29,7 @@ import { } from "@rallly/ui/form"; import { Input } from "@rallly/ui/input"; import { PencilIcon, TagIcon, TrashIcon } from "lucide-react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import React from "react"; import type { SubmitHandler } from "react-hook-form"; import { useForm } from "react-hook-form"; diff --git a/apps/web/src/components/poll-context.tsx b/apps/web/src/components/poll-context.tsx index d754873aaa7..b3e11402942 100644 --- a/apps/web/src/components/poll-context.tsx +++ b/apps/web/src/components/poll-context.tsx @@ -2,7 +2,7 @@ import type { Participant, VoteType } from "@rallly/database"; import dayjs from "dayjs"; import { keyBy } from "lodash"; import { TrashIcon } from "lucide-react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import React from "react"; import type { GetPollApiResponse, Vote } from "@/trpc/client/types"; diff --git a/apps/web/src/components/poll/desktop-poll.tsx b/apps/web/src/components/poll/desktop-poll.tsx index 58559685f3a..dc56797e351 100644 --- a/apps/web/src/components/poll/desktop-poll.tsx +++ b/apps/web/src/components/poll/desktop-poll.tsx @@ -12,7 +12,6 @@ import { ShrinkIcon, Users2Icon, } from "lucide-react"; -import { Trans } from "next-i18next"; import * as React from "react"; import { RemoveScroll } from "react-remove-scroll"; import { useMeasure, useScroll } from "react-use"; @@ -25,6 +24,7 @@ import { EmptyStateTitle, } from "@/components/empty-state"; import { useVotingForm } from "@/components/poll/voting-form"; +import { Trans } from "@/components/trans"; import { usePermissions } from "@/contexts/permissions"; import { usePoll } from "@/contexts/poll"; import { useTranslation } from "@/i18n/client"; diff --git a/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx b/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx index 2a06b7d00b0..f79ddf97f86 100644 --- a/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx +++ b/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx @@ -8,7 +8,7 @@ import { TooltipTrigger, } from "@rallly/ui/tooltip"; import { UndoIcon } from "lucide-react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import * as React from "react"; import { Controller } from "react-hook-form"; diff --git a/apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx b/apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx index 033ccd47558..e78a0dc2af3 100644 --- a/apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx +++ b/apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx @@ -19,7 +19,7 @@ import { } from "@rallly/ui/form"; import { RadioGroup, RadioGroupItem } from "@rallly/ui/radio-group"; import dayjs from "dayjs"; -import { Trans } from "next-i18next"; +import { Trans } from "@/components/trans"; import React from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; diff --git a/apps/web/src/components/poll/manage-poll/use-csv-exporter.ts b/apps/web/src/components/poll/manage-poll/use-csv-exporter.ts index db73156db84..605cd1a7449 100644 --- a/apps/web/src/components/poll/manage-poll/use-csv-exporter.ts +++ b/apps/web/src/components/poll/manage-poll/use-csv-exporter.ts @@ -1,7 +1,7 @@ import dayjs from "dayjs"; -import { useTranslation } from "next-i18next"; import { useOptions, usePoll } from "@/components/poll-context"; +import { useTranslation } from "@/i18n/client"; import { useParticipants } from "../../participants-provider"; diff --git a/apps/web/src/components/poll/mobile-poll.tsx b/apps/web/src/components/poll/mobile-poll.tsx index 648c83f538a..ebf22479d56 100644 --- a/apps/web/src/components/poll/mobile-poll.tsx +++ b/apps/web/src/components/poll/mobile-poll.tsx @@ -11,7 +11,7 @@ import { } from "@rallly/ui/select"; import { AnimatePresence, m } from "framer-motion"; import { MoreHorizontalIcon, PlusIcon, UsersIcon } from "lucide-react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import * as React from "react"; import smoothscroll from "smoothscroll-polyfill"; diff --git a/apps/web/src/components/poll/notifications-toggle.tsx b/apps/web/src/components/poll/notifications-toggle.tsx index 0160cd6a422..d5e9f10006d 100644 --- a/apps/web/src/components/poll/notifications-toggle.tsx +++ b/apps/web/src/components/poll/notifications-toggle.tsx @@ -4,7 +4,7 @@ import { Icon } from "@rallly/ui/icon"; import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip"; import { BellOffIcon, BellRingIcon } from "lucide-react"; import { signIn } from "next-auth/react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import * as React from "react"; import { Skeleton } from "@/components/skeleton"; diff --git a/apps/web/src/components/pro-badge.tsx b/apps/web/src/components/pro-badge.tsx index 90b1ab4c88c..7fb9cf88384 100644 --- a/apps/web/src/components/pro-badge.tsx +++ b/apps/web/src/components/pro-badge.tsx @@ -1,5 +1,5 @@ import { Badge } from "@rallly/ui/badge"; -import { Trans } from "next-i18next"; +import { Trans } from "@/components/trans"; export const ProBadge = ({ className }: { className?: string }) => { return ( diff --git a/apps/web/src/components/settings/language-preference.tsx b/apps/web/src/components/settings/language-preference.tsx index 6768dde8357..9a7c63333cc 100644 --- a/apps/web/src/components/settings/language-preference.tsx +++ b/apps/web/src/components/settings/language-preference.tsx @@ -3,7 +3,7 @@ import { Form, FormField, FormItem, FormLabel } from "@rallly/ui/form"; import { ArrowUpRight } from "lucide-react"; import Link from "next/link"; import { useRouter } from "next/navigation"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import { useForm } from "react-hook-form"; import { z } from "zod"; diff --git a/apps/web/src/components/steps/steps.tsx b/apps/web/src/components/steps/steps.tsx index 25611cff486..66b076fc1c8 100644 --- a/apps/web/src/components/steps/steps.tsx +++ b/apps/web/src/components/steps/steps.tsx @@ -1,5 +1,5 @@ import { cn } from "@rallly/ui"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import React from "react"; export interface StepsProps { diff --git a/apps/web/src/components/time-zone-picker/time-zone-select.tsx b/apps/web/src/components/time-zone-picker/time-zone-select.tsx index 70f7accf0b7..d2f62336b16 100644 --- a/apps/web/src/components/time-zone-picker/time-zone-select.tsx +++ b/apps/web/src/components/time-zone-picker/time-zone-select.tsx @@ -16,7 +16,7 @@ import { useDialog } from "@rallly/ui/dialog"; import { Icon } from "@rallly/ui/icon"; import dayjs from "dayjs"; import { CheckIcon, GlobeIcon } from "lucide-react"; -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; import React from "react"; import { Trans } from "@/components/trans"; diff --git a/apps/web/src/components/upgrade-button.tsx b/apps/web/src/components/upgrade-button.tsx index 566af933bce..06f964671a5 100644 --- a/apps/web/src/components/upgrade-button.tsx +++ b/apps/web/src/components/upgrade-button.tsx @@ -1,7 +1,7 @@ import { usePostHog } from "@rallly/posthog/client"; import { Button } from "@rallly/ui/button"; import Link from "next/link"; -import { Trans } from "next-i18next"; +import { Trans } from "@/components/trans"; import React from "react"; export const UpgradeButton = ({ diff --git a/apps/web/src/utils/form-validation.ts b/apps/web/src/utils/form-validation.ts index 2ac9b305e38..3c3f6432958 100644 --- a/apps/web/src/utils/form-validation.ts +++ b/apps/web/src/utils/form-validation.ts @@ -1,4 +1,4 @@ -import { useTranslation } from "next-i18next"; +import { useTranslation } from "@/i18n/client"; /** * @deprecated Use form validation hook instead diff --git a/yarn.lock b/yarn.lock index 0826b11ae3a..770a3709a12 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2264,7 +2264,7 @@ resolved "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime@^7.1.2", "@babel/runtime@^7.13.10", "@babel/runtime@^7.13.8", "@babel/runtime@^7.15.4", "@babel/runtime@^7.20.13", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": +"@babel/runtime@^7.1.2", "@babel/runtime@^7.13.10", "@babel/runtime@^7.13.8", "@babel/runtime@^7.15.4", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": version "7.23.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.2.tgz#062b0ac103261d68a966c4c7baf2ae3e62ec3885" integrity sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg== @@ -6359,14 +6359,6 @@ dependencies: "@types/unist" "*" -"@types/hoist-non-react-statics@^3.3.1": - version "3.3.1" - resolved "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz" - integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA== - dependencies: - "@types/react" "*" - hoist-non-react-statics "^3.3.0" - "@types/http-assert@*": version "1.5.3" resolved "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz" @@ -8045,11 +8037,6 @@ core-js-compat@^3.25.1: dependencies: browserslist "^4.21.5" -core-js@^3: - version "3.29.0" - resolved "https://registry.npmjs.org/core-js/-/core-js-3.29.0.tgz" - integrity sha512-VG23vuEisJNkGl6XQmFJd3rEG/so/CNatqeE+7uZAwTSwFeB/qaO0be8xZYUNWprJ/GIwL8aMt9cj1kvbpTZhg== - core-js@^3.38.1: version "3.38.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.38.1.tgz#aa375b79a286a670388a1a363363d53677c0383e" @@ -9887,7 +9874,7 @@ hast-util-whitespace@^3.0.0: dependencies: "@types/hast" "^3.0.0" -hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: +hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -9961,11 +9948,6 @@ hyphenate-style-name@^1.0.3: resolved "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz" integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ== -i18next-fs-backend@^2.1.1: - version "2.1.1" - resolved "https://registry.npmjs.org/i18next-fs-backend/-/i18next-fs-backend-2.1.1.tgz" - integrity sha512-FTnj+UmNgT3YRml5ruRv0jMZDG7odOL/OP5PF5mOqvXud2vHrPOOs68Zdk6iqzL47cnnM0ZVkK2BAvpFeDJToA== - i18next-icu@^2.3.0: version "2.3.0" resolved "https://registry.npmjs.org/i18next-icu/-/i18next-icu-2.3.0.tgz" @@ -11558,17 +11540,6 @@ next-auth@^5.0.0-beta.25: dependencies: "@auth/core" "0.37.2" -next-i18next@^13.0.3: - version "13.1.6" - resolved "https://registry.npmjs.org/next-i18next/-/next-i18next-13.1.6.tgz" - integrity sha512-Lgr3s3L20nAev9eJSdrXiZGZjKK69ZtH5xvu2307GfseSDtXNsZvqjNDBgucULBIbzxCsp/pmo21DdCLEUsFaw== - dependencies: - "@babel/runtime" "^7.20.13" - "@types/hoist-non-react-statics" "^3.3.1" - core-js "^3" - hoist-non-react-statics "^3.3.2" - i18next-fs-backend "^2.1.1" - next-mdx-remote@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/next-mdx-remote/-/next-mdx-remote-5.0.0.tgz#028a2cf5cf7f814d988d7ab11a401bed0f31b4ee" From e815d656fb442bc390eaf9f047cfcd02accc0e09 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Sun, 2 Mar 2025 13:12:45 +0000 Subject: [PATCH 2/6] Remove intl-messageformat --- apps/landing/package.json | 1 - apps/web/package.json | 1 - yarn.lock | 49 --------------------------------------- 3 files changed, 51 deletions(-) diff --git a/apps/landing/package.json b/apps/landing/package.json index 26c8d7bd8d9..90ff21c4e4c 100644 --- a/apps/landing/package.json +++ b/apps/landing/package.json @@ -25,7 +25,6 @@ "gray-matter": "^4.0.3", "i18next": "^24.2.2", "i18next-icu": "^2.3.0", - "intl-messageformat": "^10.3.4", "lodash": "^4.17.21", "nanoid": "^5.0.9", "next-mdx-remote": "^5.0.0", diff --git a/apps/web/package.json b/apps/web/package.json index 612b307a3e1..561e8c7e450 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -58,7 +58,6 @@ "i18next-icu": "^2.3.0", "i18next-resources-to-backend": "^1.1.4", "ics": "^3.1.0", - "intl-messageformat": "^10.3.4", "iron-session": "^6.3.1", "jose": "^5.9.6", "js-cookie": "^3.0.1", diff --git a/yarn.lock b/yarn.lock index 770a3709a12..4a5a72f8ce8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2814,45 +2814,6 @@ dependencies: "@floating-ui/dom" "^1.2.7" -"@formatjs/ecma402-abstract@1.14.3": - version "1.14.3" - resolved "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.14.3.tgz" - integrity sha512-SlsbRC/RX+/zg4AApWIFNDdkLtFbkq3LNoZWXZCE/nHVKqoIJyaoQyge/I0Y38vLxowUn9KTtXgusLD91+orbg== - dependencies: - "@formatjs/intl-localematcher" "0.2.32" - tslib "^2.4.0" - -"@formatjs/fast-memoize@2.0.1": - version "2.0.1" - resolved "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-2.0.1.tgz" - integrity sha512-M2GgV+qJn5WJQAYewz7q2Cdl6fobQa69S1AzSM2y0P68ZDbK5cWrJIcPCO395Of1ksftGZoOt4LYCO/j9BKBSA== - dependencies: - tslib "^2.4.0" - -"@formatjs/icu-messageformat-parser@2.3.1": - version "2.3.1" - resolved "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.3.1.tgz" - integrity sha512-knF2AkAKN4Upv4oIiKY4Wd/dLH68TNMPgV/tJMu/T6FP9aQwbv8fpj7U3lkyniPaNVxvia56Gxax8MKOjtxLSQ== - dependencies: - "@formatjs/ecma402-abstract" "1.14.3" - "@formatjs/icu-skeleton-parser" "1.3.18" - tslib "^2.4.0" - -"@formatjs/icu-skeleton-parser@1.3.18": - version "1.3.18" - resolved "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.18.tgz" - integrity sha512-ND1ZkZfmLPcHjAH1sVpkpQxA+QYfOX3py3SjKWMUVGDow18gZ0WPqz3F+pJLYQMpS2LnnQ5zYR2jPVYTbRwMpg== - dependencies: - "@formatjs/ecma402-abstract" "1.14.3" - tslib "^2.4.0" - -"@formatjs/intl-localematcher@0.2.32": - version "0.2.32" - resolved "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.2.32.tgz" - integrity sha512-k/MEBstff4sttohyEpXxCmC3MqbUn9VvHGlZ8fauLzkbwXmVrEeyzS+4uhrvAk9DWU9/7otYWxyDox4nT/KVLQ== - dependencies: - tslib "^2.4.0" - "@hapi/hoek@^9.0.0": version "9.3.0" resolved "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz" @@ -10120,16 +10081,6 @@ interpret@^1.0.0: resolved "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -intl-messageformat@^10.3.4: - version "10.3.4" - resolved "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.3.4.tgz" - integrity sha512-/FxUIrlbPtuykSNX85CB5sp2FjLVeTmdD7TfRkVFPft2n4FgcSlAcilFytYiFAEmPHc+0PvpLCIPXeaGFzIvOg== - dependencies: - "@formatjs/ecma402-abstract" "1.14.3" - "@formatjs/fast-memoize" "2.0.1" - "@formatjs/icu-messageformat-parser" "2.3.1" - tslib "^2.4.0" - invariant@^2.2.4: version "2.2.4" resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz" From 8205370e00e00cffda1dee37bec5f029f0f41714 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Sun, 2 Mar 2025 13:15:08 +0000 Subject: [PATCH 3/6] Update imports --- apps/landing/src/app/[locale]/footer.tsx | 3 ++- apps/landing/src/app/[locale]/layout.tsx | 2 +- apps/landing/src/app/[locale]/pricing/pricing-table.tsx | 2 +- apps/landing/src/components/error-page.tsx | 2 +- apps/landing/src/components/home/hero.tsx | 2 +- apps/landing/src/i18n/client/index.ts | 3 --- 6 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 apps/landing/src/i18n/client/index.ts diff --git a/apps/landing/src/app/[locale]/footer.tsx b/apps/landing/src/app/[locale]/footer.tsx index 1960844977d..c1ccb4cd484 100644 --- a/apps/landing/src/app/[locale]/footer.tsx +++ b/apps/landing/src/app/[locale]/footer.tsx @@ -21,7 +21,8 @@ import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import * as React from "react"; -import { Trans, useTranslation } from "@/i18n/client"; +import { Trans } from "@/i18n/client/trans"; +import { useTranslation } from "@/i18n/client/use-translation"; const LanguageSelect = () => { const router = useRouter(); diff --git a/apps/landing/src/app/[locale]/layout.tsx b/apps/landing/src/app/[locale]/layout.tsx index c493d035e09..f123f58cadf 100644 --- a/apps/landing/src/app/[locale]/layout.tsx +++ b/apps/landing/src/app/[locale]/layout.tsx @@ -17,7 +17,7 @@ import Link from "next/link"; import { Trans } from "react-i18next/TransWithoutContext"; import { sans } from "@/fonts/sans"; -import { I18nProvider } from "@/i18n/client"; +import { I18nProvider } from "@/i18n/client/i18n-provider"; import { getTranslation } from "@/i18n/server"; import { linkToApp } from "@/lib/linkToApp"; diff --git a/apps/landing/src/app/[locale]/pricing/pricing-table.tsx b/apps/landing/src/app/[locale]/pricing/pricing-table.tsx index 4a77327bc0f..b151a8a4bce 100644 --- a/apps/landing/src/app/[locale]/pricing/pricing-table.tsx +++ b/apps/landing/src/app/[locale]/pricing/pricing-table.tsx @@ -18,7 +18,7 @@ import Link from "next/link"; import React from "react"; import { Trans } from "react-i18next/TransWithoutContext"; -import { useTranslation } from "@/i18n/client"; +import { useTranslation } from "@/i18n/client/use-translation"; import { linkToApp } from "@/lib/linkToApp"; export function PriceTables() { diff --git a/apps/landing/src/components/error-page.tsx b/apps/landing/src/components/error-page.tsx index 0201b914629..86ad294f22f 100644 --- a/apps/landing/src/components/error-page.tsx +++ b/apps/landing/src/components/error-page.tsx @@ -5,7 +5,7 @@ import { FileSearchIcon } from "lucide-react"; import Link from "next/link"; import * as React from "react"; -import { useTranslation } from "@/i18n/client"; +import { useTranslation } from "@/i18n/client/use-translation"; export interface ComponentProps { icon?: React.ReactNode; diff --git a/apps/landing/src/components/home/hero.tsx b/apps/landing/src/components/home/hero.tsx index 8abe377565f..9e6038bdae6 100644 --- a/apps/landing/src/components/home/hero.tsx +++ b/apps/landing/src/components/home/hero.tsx @@ -8,8 +8,8 @@ import Image from "next/image"; import Link from "next/link"; import * as React from "react"; -import { Trans } from "@/i18n/client/trans"; import { handwritten } from "@/fonts/handwritten"; +import { Trans } from "@/i18n/client/trans"; import { linkToApp } from "@/lib/linkToApp"; const Screenshot = () => { diff --git a/apps/landing/src/i18n/client/index.ts b/apps/landing/src/i18n/client/index.ts deleted file mode 100644 index 32fbf2cb29a..00000000000 --- a/apps/landing/src/i18n/client/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./i18n-provider"; -export * from "./trans"; -export * from "./use-translation"; From 496cce1c48753d66b75a22accd20d554c9082a84 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Sun, 2 Mar 2025 15:41:56 +0000 Subject: [PATCH 4/6] Fix linting --- apps/web/src/components/discussion/discussion.tsx | 2 +- apps/web/src/components/feedback.tsx | 1 + apps/web/src/components/forms/poll-details-form.tsx | 2 +- .../forms/poll-options-form/date-navigation-toolbar.tsx | 3 ++- .../forms/poll-options-form/month-calendar/month-calendar.tsx | 2 +- apps/web/src/components/new-participant-modal.tsx | 2 +- apps/web/src/components/participant-dropdown.tsx | 2 +- apps/web/src/components/poll-context.tsx | 2 +- .../src/components/poll/desktop-poll/participant-row-form.tsx | 2 +- .../src/components/poll/manage-poll/finalize-poll-dialog.tsx | 2 +- apps/web/src/components/poll/mobile-poll.tsx | 2 +- apps/web/src/components/poll/notifications-toggle.tsx | 2 +- apps/web/src/components/pro-badge.tsx | 1 + apps/web/src/components/settings/language-preference.tsx | 2 +- apps/web/src/components/steps/steps.tsx | 3 ++- apps/web/src/components/time-zone-picker/time-zone-select.tsx | 2 +- apps/web/src/components/upgrade-button.tsx | 3 ++- 17 files changed, 20 insertions(+), 15 deletions(-) diff --git a/apps/web/src/components/discussion/discussion.tsx b/apps/web/src/components/discussion/discussion.tsx index e338dfa9fd0..2e418f3c528 100644 --- a/apps/web/src/components/discussion/discussion.tsx +++ b/apps/web/src/components/discussion/discussion.tsx @@ -27,7 +27,6 @@ import { TrashIcon, } from "lucide-react"; import { signIn, useSession } from "next-auth/react"; -import { useTranslation } from "@/i18n/client"; import * as React from "react"; import { Controller, useForm } from "react-hook-form"; @@ -37,6 +36,7 @@ import { useParticipants } from "@/components/participants-provider"; import { Trans } from "@/components/trans"; import { usePoll } from "@/contexts/poll"; import { useRole } from "@/contexts/role"; +import { useTranslation } from "@/i18n/client"; import { trpc } from "@/trpc/client"; import { requiredString } from "../../utils/form-validation"; diff --git a/apps/web/src/components/feedback.tsx b/apps/web/src/components/feedback.tsx index ea56cb1ec94..04dc8604b04 100644 --- a/apps/web/src/components/feedback.tsx +++ b/apps/web/src/components/feedback.tsx @@ -14,6 +14,7 @@ import { SmileIcon, } from "lucide-react"; import Link from "next/link"; + import { Trans } from "@/components/trans"; const FeedbackButton = () => { diff --git a/apps/web/src/components/forms/poll-details-form.tsx b/apps/web/src/components/forms/poll-details-form.tsx index b1844e7e0d6..8301e3ba8d2 100644 --- a/apps/web/src/components/forms/poll-details-form.tsx +++ b/apps/web/src/components/forms/poll-details-form.tsx @@ -1,10 +1,10 @@ import { FormField, FormItem, FormLabel, FormMessage } from "@rallly/ui/form"; import { Input } from "@rallly/ui/input"; import { Textarea } from "@rallly/ui/textarea"; -import { useTranslation } from "@/i18n/client"; import { useFormContext } from "react-hook-form"; import { Trans } from "@/components/trans"; +import { useTranslation } from "@/i18n/client"; import { useFormValidation } from "@/utils/form-validation"; import type { NewEventData } from "./types"; diff --git a/apps/web/src/components/forms/poll-options-form/date-navigation-toolbar.tsx b/apps/web/src/components/forms/poll-options-form/date-navigation-toolbar.tsx index 121527d28de..e13428f4058 100644 --- a/apps/web/src/components/forms/poll-options-form/date-navigation-toolbar.tsx +++ b/apps/web/src/components/forms/poll-options-form/date-navigation-toolbar.tsx @@ -1,8 +1,9 @@ import { Button } from "@rallly/ui/button"; import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"; -import { useTranslation } from "@/i18n/client"; import * as React from "react"; +import { useTranslation } from "@/i18n/client"; + export interface DateNavigationToolbarProps { year: number; label: string; diff --git a/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx b/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx index 8eaa18789dd..05710e35556 100644 --- a/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx +++ b/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx @@ -19,12 +19,12 @@ import { SparklesIcon, XIcon, } from "lucide-react"; -import { useTranslation } from "@/i18n/client"; import * as React from "react"; import { useFormContext } from "react-hook-form"; import type { NewEventData } from "@/components/forms"; import { Trans } from "@/components/trans"; +import { useTranslation } from "@/i18n/client"; import { expectTimeOption, diff --git a/apps/web/src/components/new-participant-modal.tsx b/apps/web/src/components/new-participant-modal.tsx index 985146eaf51..3a0cc942c8b 100644 --- a/apps/web/src/components/new-participant-modal.tsx +++ b/apps/web/src/components/new-participant-modal.tsx @@ -7,11 +7,11 @@ import { FormMessage } from "@rallly/ui/form"; import { Input } from "@rallly/ui/input"; import * as Sentry from "@sentry/nextjs"; import { TRPCClientError } from "@trpc/client"; -import { useTranslation } from "@/i18n/client"; import { useForm } from "react-hook-form"; import z from "zod"; import { usePoll } from "@/contexts/poll"; +import { useTranslation } from "@/i18n/client"; import { useAddParticipantMutation } from "./poll/mutations"; import VoteIcon from "./poll/vote-icon"; diff --git a/apps/web/src/components/participant-dropdown.tsx b/apps/web/src/components/participant-dropdown.tsx index 2129d61dbc0..4ea30fc6899 100644 --- a/apps/web/src/components/participant-dropdown.tsx +++ b/apps/web/src/components/participant-dropdown.tsx @@ -29,7 +29,6 @@ import { } from "@rallly/ui/form"; import { Input } from "@rallly/ui/input"; import { PencilIcon, TagIcon, TrashIcon } from "lucide-react"; -import { useTranslation } from "@/i18n/client"; import React from "react"; import type { SubmitHandler } from "react-hook-form"; import { useForm } from "react-hook-form"; @@ -39,6 +38,7 @@ import { z } from "zod"; import { OptimizedAvatarImage } from "@/components/optimized-avatar-image"; import { useDeleteParticipantMutation } from "@/components/poll/mutations"; import { Trans } from "@/components/trans"; +import { useTranslation } from "@/i18n/client"; import { trpc } from "@/trpc/client"; import { useFormValidation } from "@/utils/form-validation"; diff --git a/apps/web/src/components/poll-context.tsx b/apps/web/src/components/poll-context.tsx index b3e11402942..8ac0354d947 100644 --- a/apps/web/src/components/poll-context.tsx +++ b/apps/web/src/components/poll-context.tsx @@ -2,9 +2,9 @@ import type { Participant, VoteType } from "@rallly/database"; import dayjs from "dayjs"; import { keyBy } from "lodash"; import { TrashIcon } from "lucide-react"; -import { useTranslation } from "@/i18n/client"; import React from "react"; +import { useTranslation } from "@/i18n/client"; import type { GetPollApiResponse, Vote } from "@/trpc/client/types"; import type { ParsedDateOption, diff --git a/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx b/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx index f79ddf97f86..1c3a2f8144c 100644 --- a/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx +++ b/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx @@ -8,7 +8,6 @@ import { TooltipTrigger, } from "@rallly/ui/tooltip"; import { UndoIcon } from "lucide-react"; -import { useTranslation } from "@/i18n/client"; import * as React from "react"; import { Controller } from "react-hook-form"; @@ -17,6 +16,7 @@ import { Participant, ParticipantName } from "@/components/participant"; import { useVotingForm } from "@/components/poll/voting-form"; import { YouAvatar } from "@/components/poll/you-avatar"; import { Trans } from "@/components/trans"; +import { useTranslation } from "@/i18n/client"; import { usePoll } from "../../poll-context"; import { toggleVote, VoteSelector } from "../vote-selector"; diff --git a/apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx b/apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx index e78a0dc2af3..2f171411ada 100644 --- a/apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx +++ b/apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx @@ -19,7 +19,6 @@ import { } from "@rallly/ui/form"; import { RadioGroup, RadioGroupItem } from "@rallly/ui/radio-group"; import dayjs from "dayjs"; -import { Trans } from "@/components/trans"; import React from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; @@ -27,6 +26,7 @@ import { z } from "zod"; import { DateIconInner } from "@/components/date-icon"; import { useParticipants } from "@/components/participants-provider"; import { ConnectedScoreSummary } from "@/components/poll/score-summary"; +import { Trans } from "@/components/trans"; import { VoteSummaryProgressBar } from "@/components/vote-summary-progress-bar"; import { usePoll } from "@/contexts/poll"; import { trpc } from "@/trpc/client"; diff --git a/apps/web/src/components/poll/mobile-poll.tsx b/apps/web/src/components/poll/mobile-poll.tsx index ebf22479d56..a3ccd707517 100644 --- a/apps/web/src/components/poll/mobile-poll.tsx +++ b/apps/web/src/components/poll/mobile-poll.tsx @@ -11,7 +11,6 @@ import { } from "@rallly/ui/select"; import { AnimatePresence, m } from "framer-motion"; import { MoreHorizontalIcon, PlusIcon, UsersIcon } from "lucide-react"; -import { useTranslation } from "@/i18n/client"; import * as React from "react"; import smoothscroll from "smoothscroll-polyfill"; @@ -24,6 +23,7 @@ import { YouAvatar } from "@/components/poll/you-avatar"; import { useOptions, usePoll } from "@/components/poll-context"; import { Trans } from "@/components/trans"; import { usePermissions } from "@/contexts/permissions"; +import { useTranslation } from "@/i18n/client"; import { useVisibleParticipants } from "../participants-provider"; import { useUser } from "../user-provider"; diff --git a/apps/web/src/components/poll/notifications-toggle.tsx b/apps/web/src/components/poll/notifications-toggle.tsx index d5e9f10006d..88aa7b3cbc0 100644 --- a/apps/web/src/components/poll/notifications-toggle.tsx +++ b/apps/web/src/components/poll/notifications-toggle.tsx @@ -4,12 +4,12 @@ import { Icon } from "@rallly/ui/icon"; import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip"; import { BellOffIcon, BellRingIcon } from "lucide-react"; import { signIn } from "next-auth/react"; -import { useTranslation } from "@/i18n/client"; import * as React from "react"; import { Skeleton } from "@/components/skeleton"; import { Trans } from "@/components/trans"; import { useUser } from "@/components/user-provider"; +import { useTranslation } from "@/i18n/client"; import { trpc } from "@/trpc/client"; import { usePoll } from "../poll-context"; diff --git a/apps/web/src/components/pro-badge.tsx b/apps/web/src/components/pro-badge.tsx index 7fb9cf88384..17068626b60 100644 --- a/apps/web/src/components/pro-badge.tsx +++ b/apps/web/src/components/pro-badge.tsx @@ -1,4 +1,5 @@ import { Badge } from "@rallly/ui/badge"; + import { Trans } from "@/components/trans"; export const ProBadge = ({ className }: { className?: string }) => { diff --git a/apps/web/src/components/settings/language-preference.tsx b/apps/web/src/components/settings/language-preference.tsx index 9a7c63333cc..e948c88321c 100644 --- a/apps/web/src/components/settings/language-preference.tsx +++ b/apps/web/src/components/settings/language-preference.tsx @@ -3,13 +3,13 @@ import { Form, FormField, FormItem, FormLabel } from "@rallly/ui/form"; import { ArrowUpRight } from "lucide-react"; import Link from "next/link"; import { useRouter } from "next/navigation"; -import { useTranslation } from "@/i18n/client"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { LanguageSelect } from "@/components/poll/language-selector"; import { Trans } from "@/components/trans"; import { usePreferences } from "@/contexts/preferences"; +import { useTranslation } from "@/i18n/client"; const formSchema = z.object({ language: z.string(), diff --git a/apps/web/src/components/steps/steps.tsx b/apps/web/src/components/steps/steps.tsx index 66b076fc1c8..5b72cdfb6a4 100644 --- a/apps/web/src/components/steps/steps.tsx +++ b/apps/web/src/components/steps/steps.tsx @@ -1,7 +1,8 @@ import { cn } from "@rallly/ui"; -import { useTranslation } from "@/i18n/client"; import React from "react"; +import { useTranslation } from "@/i18n/client"; + export interface StepsProps { current: number; total: number; diff --git a/apps/web/src/components/time-zone-picker/time-zone-select.tsx b/apps/web/src/components/time-zone-picker/time-zone-select.tsx index d2f62336b16..1b220ff1713 100644 --- a/apps/web/src/components/time-zone-picker/time-zone-select.tsx +++ b/apps/web/src/components/time-zone-picker/time-zone-select.tsx @@ -16,10 +16,10 @@ import { useDialog } from "@rallly/ui/dialog"; import { Icon } from "@rallly/ui/icon"; import dayjs from "dayjs"; import { CheckIcon, GlobeIcon } from "lucide-react"; -import { useTranslation } from "@/i18n/client"; import React from "react"; import { Trans } from "@/components/trans"; +import { useTranslation } from "@/i18n/client"; import { groupedTimeZones } from "@/utils/grouped-time-zone"; interface TimeZoneCommandProps { diff --git a/apps/web/src/components/upgrade-button.tsx b/apps/web/src/components/upgrade-button.tsx index 06f964671a5..4dca33e54f2 100644 --- a/apps/web/src/components/upgrade-button.tsx +++ b/apps/web/src/components/upgrade-button.tsx @@ -1,9 +1,10 @@ import { usePostHog } from "@rallly/posthog/client"; import { Button } from "@rallly/ui/button"; import Link from "next/link"; -import { Trans } from "@/components/trans"; import React from "react"; +import { Trans } from "@/components/trans"; + export const UpgradeButton = ({ children, annual, From 245dfc06c345a5900356b5e97f506233445fec5f Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Sun, 2 Mar 2025 15:46:23 +0000 Subject: [PATCH 5/6] Update intl-messageformat --- apps/landing/package.json | 1 + apps/web/package.json | 1 + yarn.lock | 61 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/apps/landing/package.json b/apps/landing/package.json index 90ff21c4e4c..f0d9e97c08a 100644 --- a/apps/landing/package.json +++ b/apps/landing/package.json @@ -25,6 +25,7 @@ "gray-matter": "^4.0.3", "i18next": "^24.2.2", "i18next-icu": "^2.3.0", + "intl-messageformat": "^10.7.15", "lodash": "^4.17.21", "nanoid": "^5.0.9", "next-mdx-remote": "^5.0.0", diff --git a/apps/web/package.json b/apps/web/package.json index 561e8c7e450..1ece64b1ccb 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -58,6 +58,7 @@ "i18next-icu": "^2.3.0", "i18next-resources-to-backend": "^1.1.4", "ics": "^3.1.0", + "intl-messageformat": "^10.7.15", "iron-session": "^6.3.1", "jose": "^5.9.6", "js-cookie": "^3.0.1", diff --git a/yarn.lock b/yarn.lock index 4a5a72f8ce8..91ac3b7f9bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2814,6 +2814,47 @@ dependencies: "@floating-ui/dom" "^1.2.7" +"@formatjs/ecma402-abstract@2.3.3": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-2.3.3.tgz#fbc7555c9e4fdd104cd5e23129fa3735be3ad0ba" + integrity sha512-pJT1OkhplSmvvr6i3CWTPvC/FGC06MbN5TNBfRO6Ox62AEz90eMq+dVvtX9Bl3jxCEkS0tATzDarRZuOLw7oFg== + dependencies: + "@formatjs/fast-memoize" "2.2.6" + "@formatjs/intl-localematcher" "0.6.0" + decimal.js "10" + tslib "2" + +"@formatjs/fast-memoize@2.2.6": + version "2.2.6" + resolved "https://registry.yarnpkg.com/@formatjs/fast-memoize/-/fast-memoize-2.2.6.tgz#fac0a84207a1396be1f1aa4ee2805b179e9343d1" + integrity sha512-luIXeE2LJbQnnzotY1f2U2m7xuQNj2DA8Vq4ce1BY9ebRZaoPB1+8eZ6nXpLzsxuW5spQxr7LdCg+CApZwkqkw== + dependencies: + tslib "2" + +"@formatjs/icu-messageformat-parser@2.11.1": + version "2.11.1" + resolved "https://registry.yarnpkg.com/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.11.1.tgz#59d69124b9cf3186800a576c0228947d10594347" + integrity sha512-o0AhSNaOfKoic0Sn1GkFCK4MxdRsw7mPJ5/rBpIqdvcC7MIuyUSW8WChUEvrK78HhNpYOgqCQbINxCTumJLzZA== + dependencies: + "@formatjs/ecma402-abstract" "2.3.3" + "@formatjs/icu-skeleton-parser" "1.8.13" + tslib "2" + +"@formatjs/icu-skeleton-parser@1.8.13": + version "1.8.13" + resolved "https://registry.yarnpkg.com/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.8.13.tgz#5e8b1e1bb467c937735fecb4cb4b345932151a44" + integrity sha512-N/LIdTvVc1TpJmMt2jVg0Fr1F7Q1qJPdZSCs19unMskCmVQ/sa0H9L8PWt13vq+gLdLg1+pPsvBLydL1Apahjg== + dependencies: + "@formatjs/ecma402-abstract" "2.3.3" + tslib "2" + +"@formatjs/intl-localematcher@0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.6.0.tgz#33cf0d33279572c990e02ab75a93122569878082" + integrity sha512-4rB4g+3hESy1bHSBG3tDFaMY2CH67iT7yne1e+0CLTsGLDcmoEWWpJjjpWVaYgYfYuohIRuo0E+N536gd2ZHZA== + dependencies: + tslib "2" + "@hapi/hoek@^9.0.0": version "9.3.0" resolved "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz" @@ -8194,6 +8235,11 @@ decamelize@^1.1.0, decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== +decimal.js@10: + version "10.5.0" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.5.0.tgz#0f371c7cf6c4898ce0afb09836db73cd82010f22" + integrity sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw== + decode-named-character-reference@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz" @@ -10081,6 +10127,16 @@ interpret@^1.0.0: resolved "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== +intl-messageformat@^10.7.15: + version "10.7.15" + resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-10.7.15.tgz#5cdc62139ef39ece1b083db32dae4d1c9fa5b627" + integrity sha512-LRyExsEsefQSBjU2p47oAheoKz+EOJxSLDdjOaEjdriajfHsMXOmV/EhMvYSg9bAgCUHasuAC+mcUBe/95PfIg== + dependencies: + "@formatjs/ecma402-abstract" "2.3.3" + "@formatjs/fast-memoize" "2.2.6" + "@formatjs/icu-messageformat-parser" "2.11.1" + tslib "2" + invariant@^2.2.4: version "2.2.4" resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz" @@ -13939,6 +13995,11 @@ tsconfig-paths@^3.14.1, tsconfig-paths@^3.14.2: minimist "^1.2.6" strip-bom "^3.0.0" +tslib@2: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + tslib@^1.11.1: version "1.14.1" resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" From a2e86930306ab51b4f9dda655042e7c9d7d42843 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Sun, 2 Mar 2025 15:49:42 +0000 Subject: [PATCH 6/6] Update i18next-resources-to-backend --- apps/landing/package.json | 1 + apps/web/package.json | 2 +- yarn.lock | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/landing/package.json b/apps/landing/package.json index f0d9e97c08a..41c68c4ea1a 100644 --- a/apps/landing/package.json +++ b/apps/landing/package.json @@ -25,6 +25,7 @@ "gray-matter": "^4.0.3", "i18next": "^24.2.2", "i18next-icu": "^2.3.0", + "i18next-resources-to-backend": "^1.2.1", "intl-messageformat": "^10.7.15", "lodash": "^4.17.21", "nanoid": "^5.0.9", diff --git a/apps/web/package.json b/apps/web/package.json index 1ece64b1ccb..688aebeebb9 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -56,7 +56,7 @@ "dayjs": "^1.11.10", "i18next": "^24.2.2", "i18next-icu": "^2.3.0", - "i18next-resources-to-backend": "^1.1.4", + "i18next-resources-to-backend": "^1.2.1", "ics": "^3.1.0", "intl-messageformat": "^10.7.15", "iron-session": "^6.3.1", diff --git a/yarn.lock b/yarn.lock index 91ac3b7f9bc..6918ffd841b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2264,7 +2264,7 @@ resolved "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime@^7.1.2", "@babel/runtime@^7.13.10", "@babel/runtime@^7.13.8", "@babel/runtime@^7.15.4", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": +"@babel/runtime@^7.1.2", "@babel/runtime@^7.13.10", "@babel/runtime@^7.13.8", "@babel/runtime@^7.15.4", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": version "7.23.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.2.tgz#062b0ac103261d68a966c4c7baf2ae3e62ec3885" integrity sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg== @@ -9960,12 +9960,12 @@ i18next-icu@^2.3.0: resolved "https://registry.npmjs.org/i18next-icu/-/i18next-icu-2.3.0.tgz" integrity sha512-x+j7kd5nDJCfbU53uwsMfXD7ALPu5uv0bqjAMQ5nVvXRoj1L7gkmswKtM3XDWYo4YUHf1jznlhSdPyy0xEwU+Q== -i18next-resources-to-backend@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/i18next-resources-to-backend/-/i18next-resources-to-backend-1.1.4.tgz#d139ca0cacc270dcc90b7926e192f4cd5aa4db60" - integrity sha512-hMyr9AOmIea17AOaVe1srNxK/l3mbk81P7Uf3fdcjlw3ehZy3UNTd0OP3EEi6yu4J02kf9jzhCcjokz6AFlEOg== +i18next-resources-to-backend@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/i18next-resources-to-backend/-/i18next-resources-to-backend-1.2.1.tgz#fded121e63e3139ce839c9901b9449dbbea7351d" + integrity sha512-okHbVA+HZ7n1/76MsfhPqDou0fptl2dAlhRDu2ideXloRRduzHsqDOznJBef+R3DFZnbvWoBW+KxJ7fnFjd6Yw== dependencies: - "@babel/runtime" "^7.21.5" + "@babel/runtime" "^7.23.2" i18next-scanner-typescript@^1.1.1: version "1.1.1"