- Create auth.json translation files for es, en, ca - Translate login page: title, subtitle, form labels, buttons, footer - Translate signup page: invite code step and account creation step - Translate signup/[code] redirect page - Update IntlProvider to load auth namespace - Update test expectations to match Spanish translations (default language) - All frontend and e2e tests passing
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
"use client";
|
|
|
|
import { NextIntlClientProvider } from "next-intl";
|
|
import { ReactNode, useMemo } from "react";
|
|
import { useLanguage } from "../hooks/useLanguage";
|
|
|
|
// Import all locale messages
|
|
import esCommon from "../../locales/es/common.json";
|
|
import enCommon from "../../locales/en/common.json";
|
|
import caCommon from "../../locales/ca/common.json";
|
|
import esNavigation from "../../locales/es/navigation.json";
|
|
import enNavigation from "../../locales/en/navigation.json";
|
|
import caNavigation from "../../locales/ca/navigation.json";
|
|
import esExchange from "../../locales/es/exchange.json";
|
|
import enExchange from "../../locales/en/exchange.json";
|
|
import caExchange from "../../locales/ca/exchange.json";
|
|
import esAuth from "../../locales/es/auth.json";
|
|
import enAuth from "../../locales/en/auth.json";
|
|
import caAuth from "../../locales/ca/auth.json";
|
|
|
|
const messages = {
|
|
es: { common: esCommon, navigation: esNavigation, exchange: esExchange, auth: esAuth },
|
|
en: { common: enCommon, navigation: enNavigation, exchange: enExchange, auth: enAuth },
|
|
ca: { common: caCommon, navigation: caNavigation, exchange: caExchange, auth: caAuth },
|
|
};
|
|
|
|
interface IntlProviderProps {
|
|
children: ReactNode;
|
|
}
|
|
|
|
export function IntlProvider({ children }: IntlProviderProps) {
|
|
const { locale } = useLanguage();
|
|
|
|
const localeMessages = useMemo(() => {
|
|
return messages[locale] || messages.es;
|
|
}, [locale]);
|
|
|
|
return (
|
|
<NextIntlClientProvider locale={locale} messages={localeMessages}>
|
|
{children}
|
|
</NextIntlClientProvider>
|
|
);
|
|
}
|