locale fix

This commit is contained in:
2025-04-19 18:45:21 +01:00
parent babcc20166
commit 157e5332e3
12 changed files with 715 additions and 546 deletions
+2 -1
View File
@@ -4,7 +4,8 @@ WORKDIR /lk-results/
COPY . .
RUN npm install
RUN npm install
RUN npm audit fix --force
RUN npm run build
RUN npm install -g serve
+694 -536
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -30,6 +30,7 @@
"sort-by": "^0.0.2"
},
"devDependencies": {
"@types/node": "^22.14.1",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^6.21.0",
@@ -42,6 +43,6 @@
"postcss": "^8.4.38",
"tailwindcss": "^3.4.4",
"typescript": "^5.2.2",
"vite": "^5.1.0"
"vite": "^6.3.2"
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
import { useTranslation } from "react-i18next";
const Footer = () => {
const { t, i18n } = useTranslation();
const { t } = useTranslation();
return (
<footer className="flex flex-col items-center justify-center py-6 px-4 mt-10 border-t border-gray-800 bg-transparent">
+4 -4
View File
@@ -128,9 +128,9 @@ export default () => {
<div className="hidden lg:flex lg:items-center ml-auto">
<button
className="text-white hover:text-gold-accent transition-colors duration-200"
onClick={() => changeLanguage(i18n.language === "en-GB" ? "pt-PT" : "en-GB")}
onClick={() => changeLanguage(i18n.language === "en" ? "pt" : "en")}
>
{i18n.language === "en-GB" ? "PT" : "EN"}
{i18n.language === "en" ? "PT" : "EN"}
</button>
</div>
@@ -168,9 +168,9 @@ export default () => {
</ul>
<button
className="absolute bottom-10 right-10 text-white hover:text-gold-accent transition-colors duration-200"
onClick={() => changeLanguage(i18n.language === "en-GB" ? "pt-PT" : "en-GB")}
onClick={() => changeLanguage(i18n.language === "en" ? "pt" : "en")}
>
{i18n.language === "en-GB" ? "PT" : "EN"}
{i18n.language === "en" ? "PT" : "EN"}
</button>
</div>
+12 -3
View File
@@ -17,10 +17,19 @@ i18n
defaultNS: 'common',
backend: {
// translation file path
loadPath: (lng : string,) => `/public/locales/common/${lng}.json`,
loadPath: (lngs: string[], namespaces: string[]) => {
// i18next-http-backend passes arrays for lngs and namespaces
const lng = lngs[0];
const ns = namespaces[0];
return `/locales/${ns}/${lng}.json`;
},
},
debug: true,
fallbackLng: "en-GB",
// 'process.env.NODE_ENV' is replaced at build time by most bundlers (Vite, CRA, Webpack) to control debug mode.
// TypeScript may show a warning about 'process' not being defined. You can safely ignore this if using a modern React toolchain.
// To silence the error in your editor, install Node types: npm install --save-dev @types/node
debug: process.env.NODE_ENV !== "production",
fallbackLng: { default: ["en"] },
supportedLngs: ["en", "pt"],
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},