diff --git a/src/frontend/static/frontend/rspack.common.js b/src/frontend/static/frontend/rspack.common.js index e7f41f91..13bdbbf8 100644 --- a/src/frontend/static/frontend/rspack.common.js +++ b/src/frontend/static/frontend/rspack.common.js @@ -26,7 +26,8 @@ export const common = { survival: `${PATHS.src}/survival.tsx`, aboutUs: `${PATHS.src}/about-us.tsx`, openSource: `${PATHS.src}/open-source.tsx`, - sitePolicy: `${PATHS.src}/site-policy.tsx` + sitePolicy: `${PATHS.src}/site-policy.tsx`, + faq: `${PATHS.src}/faq.tsx` }, output: { path: PATHS.output, diff --git a/src/frontend/static/frontend/src/components/Base.tsx b/src/frontend/static/frontend/src/components/Base.tsx index b70f80e2..84425088 100644 --- a/src/frontend/static/frontend/src/components/Base.tsx +++ b/src/frontend/static/frontend/src/components/Base.tsx @@ -4,6 +4,26 @@ import ky from 'ky' import { DjangoUser } from '../utils/django_interfaces' import { Nullable } from '../utils/interfaces' import { Footer } from './Footer' +import { IntlProvider } from 'react-intl' + +// Locales +import es from '../locales/es' +import en from '../locales/en' + +// Common dependencies for all the pages +import 'fomantic-ui-css/semantic.css' +import '../css/base.css' + +const messages = { en, es } + +interface LocaleContextType { + locale: 'en' | 'es', + setLocale: React.Dispatch> +} +const LocaleContext = React.createContext({ + locale: 'es', + setLocale: () => {} +}) declare const urlCurrentUser: string @@ -29,6 +49,8 @@ const Base = (props: BaseProps) => { const abortController = useRef(new AbortController()) const [currentUser, setUser] = useState>(null) const [isLoadingCurrentUser, setIsLoadingCurrentUser] = useState(true) + // State that defines the current language ('es' or 'en') for , used to display the interface in the selected locale + const [locale, setLocale] = useState<'en' | 'es'>('es') /** * Method which is executed when the component has mounted @@ -75,17 +97,21 @@ const Base = (props: BaseProps) => { return ( - {/* Navbar */} - + + + {/* Navbar */} + - {/* Composition part */} -
- {props.children} -
+ {/* Composition part */} +
+ {props.children} +
- {/* Footer */} - {/* TODO: add license */} -