Add react-intl infrastructure

This commit is contained in:
Jimi hackathon
2026-06-27 17:44:37 -03:00
parent fd45878b06
commit 04dd5b2173
6 changed files with 166 additions and 123 deletions

View File

@@ -6,11 +6,13 @@
import { lazy, Suspense, useEffect } from "react";
import { HashRouter as Router, Routes, Route, useLocation } from "react-router-dom";
import { IntlProvider } from 'react-intl';
import "./App.css";
import HomePage from "./pages/HomePage/HomePage";
import LabPython from "./pages/LabPython/LabPython";
import ScrollToTop from "./components/ScrollToTop";
import { trackPageView } from "./services/plausible";
import { getLocalizedMessages } from "./services/localizedMessages";
const Playground = lazy(() => import("./pages/Playground/Playground"));
const About = lazy(() => import("./pages/About/About"));
@@ -116,10 +118,15 @@ function AppRoutes() {
}
export default function App() {
const locale = 'ht';
const translatedMessages = getLocalizedMessages(locale);
console.log(translatedMessages);
return (
<Router>
<Suspense fallback={<LoadingFallback />}>
<AppRoutes />
<IntlProvider messages={translatedMessages} locale={locale} defaultLocale="pt">
<AppRoutes />
</IntlProvider>
</Suspense>
</Router>
);

View File

@@ -0,0 +1,8 @@
import ht from "./../../lang/ht.json";
import pt from "./../../lang/pt.json";
export function getLocalizedMessages(locale) {
return {
ht,
pt
};
}