Skip to content

Commit

Permalink
toniebox-reverse-engineeringgh-127 added translation overview page, p…
Browse files Browse the repository at this point in the history
  • Loading branch information
henryk86 committed Oct 8, 2024
1 parent 11d21ab commit 42f7c17
Show file tree
Hide file tree
Showing 19 changed files with 866 additions and 40 deletions.
18 changes: 16 additions & 2 deletions public/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@
"navigationTitle": "Forum"
},
"navigationTitle": "Community",
"title": "Community"
"title": "Community",
"translations": {
"navigationTitle": "Übersetzungen",
"title": "Übersetzungen",
"language": "Sprache",
"missingKeys": "Fehlende Schlüssel",
"noMissingKeys": "Keine fehlenden Schlüssel.",
"extraKeys": "Zusätzliche Schlüssel",
"noExtraKeys": "Keine zusätzlichen Schlüssel.",
"missingExtraKeysHeadline": "Fehlende / Zusätzliche Übersetzungsschlüssel",
"noDiscrepancies": "Alles ist in Ordnung.",
"missing": "FEHLT",
"key": "Schlüssel",
"allTranslationStrings": "Alle Übersetzungsstrings",
"hint": "Wenn du eine schlechte Übersetzung siehst, komm bitte über Telegram auf uns zu. Französisch und Spanisch werden derzeit vollständig von ChatGPT übersetzt."
}
},
"confirmDialog": {
"contentHintTitle": "Denk dran"
Expand Down Expand Up @@ -271,7 +286,6 @@
"tonieMeeting": {
"navigationTitle": "Tonie Meeting"
},
"yourCustomTonies": "Deine Custom Tonies",
"yourTonies": "Deine Tonies"
},
"inputValidator": {
Expand Down
18 changes: 17 additions & 1 deletion public/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@
"navigationTitle": "Forum"
},
"navigationTitle": "Community",
"title": "Community"
"title": "Community",
"translations": {
"navigationTitle": "Translations",
"title": "Translations",
"language": "Language",
"missingKeys": "Missing keys",
"noMissingKeys": "No missing keys.",
"extraKeys": "Extra keys",
"noExtraKeys": "No extra keys.",
"missingExtraKeysHeadline": "Missing / Extra Translation keys",
"noDiscrepancies": "Everything is fine.",
"missing": "MISSING",
"key": "Key",
"allTranslationStrings": "All Translation strings",
"hint": "If you see any bad translation, please come back to us on Telegram. French and Spanish are currently completely translated by ChatGPT."
}
},
"confirmDialog": {
"contentHintTitle": "Keep in mind"
Expand Down Expand Up @@ -351,6 +366,7 @@
"toniesJsonReloadFailed": "Failed to reload Tonies(.custom).json!",
"toniesJsonReloadInProgress": "Loading Tonies(.custom).json...",
"toniesJsonReloadSuccessful": "Tonies(.custom).json reloaded successfully!",

"warning": "Attention! Save button + Settings level",
"warningHint": "Text inputs currently have to be saved explicitly until a better solution is implemented. To do this, click on the save symbol at the end of the field. If you are missing settings, increase the 'Settings level'."
},
Expand Down
18 changes: 17 additions & 1 deletion public/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@
"navigationTitle": "Foro"
},
"navigationTitle": "Comunidad",
"title": "Comunidad"
"title": "Comunidad",
"translations": {
"navigationTitle": "Traducciones",
"title": "Traducciones",
"language": "Idioma",
"missingKeys": "Claves faltantes",
"noMissingKeys": "No hay claves faltantes.",
"extraKeys": "Claves adicionales",
"noExtraKeys": "No hay claves adicionales.",
"missingExtraKeysHeadline": "Claves de traducción faltantes / adicionales",
"noDiscrepancies": "Todo está bien.",
"missing": "FALTANTE",
"key": "Clave",
"allTranslationStrings": "Todas las cadenas de traducción",
"hint": "Si ves alguna mala traducción, por favor vuelve a contactarnos por Telegram. El francés y el español están actualmente completamente traducidos por ChatGPT."
}
},
"confirmDialog": {
"contentHintTitle": "Ten en cuenta"
Expand Down Expand Up @@ -351,6 +366,7 @@
"toniesJsonReloadFailed": "¡Error al recargar Tonies(.custom).json!",
"toniesJsonReloadInProgress": "Cargando Tonies(.custom).json...",
"toniesJsonReloadSuccessful": "¡Tonies(.custom).json recargado con éxito!",

"warning": "¡Atención! Botón Guardar + Nivel de configuración",
"warningHint": "Actualmente, los campos de texto deben guardarse explícitamente hasta que se implemente una mejor solución. Para hacerlo, haz clic en el símbolo de guardar al final del campo. Si faltan configuraciones, aumenta el 'Nivel de configuración'."
},
Expand Down
26 changes: 20 additions & 6 deletions public/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@
"navigationTitle": "Forum"
},
"navigationTitle": "Communauté",
"title": "Communauté"
"title": "Communauté",
"translations": {
"navigationTitle": "Traductions",
"title": "Traductions",
"language": "Langue",
"missingKeys": "Clés manquantes",
"noMissingKeys": "Aucune clé manquante.",
"extraKeys": "Clés supplémentaires",
"noExtraKeys": "Aucune clé supplémentaire.",
"missingExtraKeysHeadline": "Clés de traduction manquantes / supplémentaires",
"noDiscrepancies": "Tout va bien.",
"missing": "MANQUANT",
"key": "Clé",
"allTranslationStrings": "Toutes les chaînes de traduction",
"hint": "Si tu vois une mauvaise traduction, reviens vers nous sur Telegram. Le français et l'espagnol sont actuellement complètement traduits par ChatGPT."
}
},
"confirmDialog": {
"contentHintTitle": "Garde à l'esprit"
Expand Down Expand Up @@ -471,7 +486,6 @@
"readingFlash": "Lecture du flash...",
"readyToProceed": ", prêt à continuer.",
"retrievingMac": "Récupération de l'adresse MAC...",
"title": "Flashage de la boîte ESP32",
"titleESP32FirmwareFlashed": "ESP32 flashé",
"titleFlashESP32": "Flasher l'ESP32",
"titlePatchFlash": "Patch Flash",
Expand Down Expand Up @@ -638,10 +652,10 @@
"liveEnabled": "En direct activé!",
"setToEmptyValue": "vide",
"setTonieToModelFailed": "Impossible de changer le modèle de Tonie!",
"setTonieToModelSuccess": "Le modèle a été changé pour: ",
"setTonieToRadioStreamSuccess": "Le flux radio a été changé pour: ",
"setTracklistFailed": "Impossible de modifier la liste de lecture: ",
"successfulTonieUpdate": "Tonie mis à jour avec succès!"
"setTonieToModelSuccessful": "Le modèle a été changé pour: ",
"setTonieToSourceFailed": "Impossible de changer la source du tonie !",
"setTonieToSourceSuccessful": "Source du tonie définie sur {{selectedSource}} !",
"sourceSetSuccessful": "Source définie sur {{selectedFile}} !"
},
"navigationTitle": "Tonies",
"selectFileModal": {
Expand Down
39 changes: 32 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ import { ChangelogPage } from "./pages/community/ChangelogPage";
import { useState, useEffect } from "react";
import { ConfigProvider, theme } from "antd";
import { SunOutlined, MoonOutlined, BulbOutlined } from "@ant-design/icons";
import { ESP32BoxFlashing } from "./pages/tonieboxes/ESP32BoxFlashing";
import { TonieMeetingPage } from "./pages/home/TonieMeeting";
import { ESP32BoxFlashingPage } from "./pages/tonieboxes/boxsetup/esp32/ESP32BoxFlashingPage";
import { TonieMeetingPage } from "./pages/home/TonieMeetingPage";
import { FAQPage } from "./pages/community/FAQPage";
import { FeaturesPage } from "./pages/home/FeaturesPage";
import { CC3235BoxFlashingPage } from "./pages/tonieboxes/CC3235BoxFlashing";
import { CC3200BoxFlashingPage } from "./pages/tonieboxes/CC3200BoxFlashing";
import { CC3235BoxFlashingPage } from "./pages/tonieboxes/boxsetup/cc3235/CC3235BoxFlashingPage";
import { CC3200BoxFlashingPage } from "./pages/tonieboxes/boxsetup/cc3200/CC3200BoxFlashingPage";
import { BoxSetupPage } from "./pages/tonieboxes/boxsetup/BoxSetupPage";
import { IdentifyBoxVersionPage } from "./pages/tonieboxes/boxsetup/IdentifyBoxVersionPage";
import { ESP32LegacyPage } from "./pages/tonieboxes/boxsetup/esp32/ESP32LegacyPage";
import { CC3200AltUrlPatchPage } from "./pages/tonieboxes/boxsetup/cc3200/CC3200AltUrlPatchPage";
import { TranslationsPage } from "./pages/community/TranslationsPage";

function detectColorScheme() {
const prefersDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
Expand Down Expand Up @@ -124,9 +129,28 @@ function App() {
<Route path="/tonies/encoder" element={<EncoderPage />} />
<Route path="/tonies/tap" element={<TonieAudioPlaylistsPage />} />
<Route path="/tonieboxes" element={<TonieboxesPage />} />
<Route path="/tonieboxes/esp32boxflashing" element={<ESP32BoxFlashing />} />
<Route path="/tonieboxes/cc3200boxflashing" element={<CC3200BoxFlashingPage />} />
<Route path="/tonieboxes/cc3235boxflashing" element={<CC3235BoxFlashingPage />} />
<Route path="/tonieboxes/boxsetup" element={<BoxSetupPage />} />
<Route
path="/tonieboxes/boxsetup/identifyboxversion"
element={<IdentifyBoxVersionPage />}
/>
<Route
path="/tonieboxes/boxsetup/esp32/flashing"
element={<ESP32BoxFlashingPage />}
/>
<Route path="/tonieboxes/boxsetup/esp32/legacy" element={<ESP32LegacyPage />} />
<Route
path="/tonieboxes/boxsetup/cc3200/flashing"
element={<CC3200BoxFlashingPage />}
/>
<Route
path="/tonieboxes/boxsetup/cc3200/alturlpatch"
element={<CC3200AltUrlPatchPage />}
/>
<Route
path="/tonieboxes/boxsetup/cc3235/flashing"
element={<CC3235BoxFlashingPage />}
/>
<Route path="/settings" element={<SettingsPage />} />
<Route path="/settings/certificates" element={<CertificatesPage />} />
<Route path="/settings/rtnl" element={<RtnlPage />} />
Expand All @@ -137,6 +161,7 @@ function App() {
path="/community/contribution/tonies-json"
element={<ContributionToniesJsonPage />}
/>
<Route path="/community/contribution/translations" element={<TranslationsPage />} />
<Route path="/community/contributors" element={<ContributorsPage />} />
<Route path="/community/changelog" element={<ChangelogPage />} />
<Route path="/uitest" element={<UiTest />} />
Expand Down
53 changes: 51 additions & 2 deletions src/components/community/CommunitySubNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,44 @@ import {
BranchesOutlined,
FileTextOutlined,
QuestionCircleOutlined,
GlobalOutlined,
} from "@ant-design/icons";
import React from "react";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { StyledSubMenu } from "../StyledComponents";

export const CommunitySubNav = () => {
const { t } = useTranslation();
const [openKeys, setOpenKeys] = useState<string[]>([]);

// Function to add new open key without removing existing ones
const updateOpenKeys = (pathname: string) => {
const newKeys: string[] = [];
if (pathname.includes("/contribution")) {
newKeys.push("contribution");
}
setOpenKeys((prevKeys) => Array.from(new Set([...prevKeys, ...newKeys])));
};

// Update open keys and selected keys when location changes
useEffect(() => {
updateOpenKeys(location.pathname);
}, [location.pathname]);

const onOpenChange = (keys: string[]) => {
// Check which keys are currently opened or closed
const latestOpenKey = keys.find((key) => !openKeys.includes(key)); // New key being opened
const latestCloseKey = openKeys.find((key) => !keys.includes(key)); // Key being closed

if (latestOpenKey) {
// Opening new key, merge it with previously open keys
setOpenKeys((prevKeys) => [...prevKeys, latestOpenKey]);
} else if (latestCloseKey) {
// Closing a key, filter it out from the open keys
setOpenKeys((prevKeys) => prevKeys.filter((key) => key !== latestCloseKey));
}
};

const subnav: MenuProps["items"] = [
{
Expand Down Expand Up @@ -49,6 +79,16 @@ export const CommunitySubNav = () => {
icon: React.createElement(FileTextOutlined),
title: t("community.contribution.toniesJson.navigationTitle"),
},
{
key: "translation",
label: (
<Link to="/community/contribution/translations">
{t("community.translations.navigationTitle")}
</Link>
),
icon: React.createElement(GlobalOutlined),
title: t("community.translations.navigationTitle"),
},
],
},
{
Expand All @@ -75,5 +115,14 @@ export const CommunitySubNav = () => {
},
];

return <StyledSubMenu mode="inline" defaultOpenKeys={["sub"]} items={subnav} />;
return (
<StyledSubMenu
mode="inline"
defaultOpenKeys={["sub"]}
openKeys={openKeys}
selectedKeys={[]}
onOpenChange={onOpenChange}
items={subnav}
/>
);
};
2 changes: 1 addition & 1 deletion src/components/settings/SettingsSubNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SyncOutlined,
HistoryOutlined,
} from "@ant-design/icons";
import React, { useEffect, useState } from "react";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { StyledSubMenu } from "../StyledComponents";
Expand Down
Loading

0 comments on commit 42f7c17

Please sign in to comment.