feat(homepage): add new sections to homepage

This commit is contained in:
Amruth Pillai
2023-11-13 17:03:41 +01:00
parent 4b1e33db80
commit d18b258761
79 changed files with 3096 additions and 313 deletions

View File

@ -1,30 +1,17 @@
import { i18n } from "@lingui/core";
import { t } from "@lingui/macro";
import { axios } from "./axios";
type Locale = "en-US" | "de-DE" | "zu-ZA";
export const defaultLocale = "en-US";
export const getLocales = () => {
const locales = {
"en-US": t`English`,
"de-DE": t`German`,
} as Record<Locale, string>;
if (process.env.NODE_ENV === "development") {
// eslint-disable-next-line lingui/no-unlocalized-strings
locales["zu-ZA"] = "Pseudolocalization";
}
return locales;
};
axios(`translation/${defaultLocale}`).then((response) => {
const messages = response.data;
i18n.loadAndActivate({ locale: defaultLocale, messages });
});
export async function dynamicActivate(locale: string) {
const response = await axios(`translation/${locale}`);
const messages = await response.data;
const messages = response.data;
i18n.load(locale, messages);
i18n.activate(locale);
i18n.loadAndActivate({ locale, messages });
}