Skip to content
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

♻️ Remove references to next-i18next #1597

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions apps/landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"gray-matter": "^4.0.3",
"i18next": "^24.2.2",
"i18next-icu": "^2.3.0",
"intl-messageformat": "^10.3.4",
"i18next-resources-to-backend": "^1.2.1",
"intl-messageformat": "^10.7.15",
"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",
Expand Down
4 changes: 2 additions & 2 deletions apps/landing/src/app/[locale]/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ 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 } from "@/i18n/client/trans";
import { useTranslation } from "@/i18n/client/use-translation";

const LanguageSelect = () => {
const router = useRouter();
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/app/[locale]/pricing/pricing-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion apps/landing/src/components/error-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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/use-translation";

export interface ComponentProps {
icon?: React.ReactNode;
title: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/components/home/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import Image from "next/image";
import Link from "next/link";
import * as React from "react";

import { Trans } from "@/components/trans";
import { handwritten } from "@/fonts/handwritten";
import { Trans } from "@/i18n/client/trans";
import { linkToApp } from "@/lib/linkToApp";

const Screenshot = () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/components/marketing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -28,10 +23,6 @@ async function initTranslations(lng: string) {
return i18n;
}

export function useTranslation(ns?: Namespace) {
return useTranslationOrg(ns);
}

export function I18nProvider({
locale,
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<React.ComponentProps<typeof BaseTrans>, "t">;

Expand Down
6 changes: 6 additions & 0 deletions apps/landing/src/i18n/client/use-translation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Namespace } from "i18next";
import { useTranslation as useTranslationOrg } from "react-i18next";

export function useTranslation(ns?: Namespace) {
return useTranslationOrg(ns);
}
16 changes: 0 additions & 16 deletions apps/landing/src/utils/page-translations.ts

This file was deleted.

5 changes: 2 additions & 3 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
"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.3.4",
"intl-messageformat": "^10.7.15",
"iron-session": "^6.3.1",
"jose": "^5.9.6",
"js-cookie": "^3.0.1",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 = (
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/discussion/discussion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
TrashIcon,
} from "lucide-react";
import { signIn, useSession } from "next-auth/react";
import { useTranslation } from "next-i18next";
import * as React from "react";
import { Controller, useForm } from "react-hook-form";

Expand All @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/error-page.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
SmileIcon,
} from "lucide-react";
import Link from "next/link";
import { Trans } from "next-i18next";

import { Trans } from "@/components/trans";

const FeedbackButton = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/forms/poll-details-form.tsx
Original file line number Diff line number Diff line change
@@ -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 "next-i18next";
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";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Button } from "@rallly/ui/button";
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
import { useTranslation } from "next-i18next";
import * as React from "react";

import { useTranslation } from "@/i18n/client";

export interface DateNavigationToolbarProps {
year: number;
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import {
SparklesIcon,
XIcon,
} from "lucide-react";
import { useTranslation } from "next-i18next";
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/new-participant-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 "next-i18next";
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";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/participant-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 "next-i18next";
import React from "react";
import type { SubmitHandler } from "react-hook-form";
import { useForm } from "react-hook-form";
Expand All @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/poll-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 "next-i18next";
import React from "react";

import { useTranslation } from "@/i18n/client";
import type { GetPollApiResponse, Vote } from "@/trpc/client/types";
import type {
ParsedDateOption,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/poll/desktop-poll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
TooltipTrigger,
} from "@rallly/ui/tooltip";
import { UndoIcon } from "lucide-react";
import { useTranslation } from "next-i18next";
import * as React from "react";
import { Controller } from "react-hook-form";

Expand All @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import {
} from "@rallly/ui/form";
import { RadioGroup, RadioGroupItem } from "@rallly/ui/radio-group";
import dayjs from "dayjs";
import { Trans } from "next-i18next";
import React from "react";
import { useForm } from "react-hook-form";
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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
Loading
Loading