From 461b063cffc506151f56de8eb92225d1953f1acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Mon, 6 Jul 2026 00:10:34 +0400 Subject: [PATCH] =?UTF-8?q?feat:=20regrouper=20les=20langues=20par=20conti?= =?UTF-8?q?nent,=20Afrique=20en=20t=C3=AAte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/teks/teks.js | 92 +++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 22 deletions(-) diff --git a/components/teks/teks.js b/components/teks/teks.js index 635bfac..f3eecae 100644 --- a/components/teks/teks.js +++ b/components/teks/teks.js @@ -88,15 +88,34 @@ const LANG_NAMES = { pt: 'Português', ja: '日本語', ko: '한국어', } +const CONTINENTS = ['Afrique', 'Asie', 'Europe'] + const TRAD_FIELDS = [ - {field: 'japonais', title: '日本語'}, - {field: 'coreen', title: '한국어'}, - {field: 'anglais', title: 'English'}, - {field: 'francais', title: 'Français'}, - {field: 'espagnol', title: 'Español'}, - {field: 'allemand', title: 'Deutsch'}, - {field: 'italien', title: 'Italiano'}, - {field: 'portugais', title: 'Português'}, + // Afrique — langues vedettes en premier + {field: 'yoruba', title: 'Yorùbá', continent: 'Afrique'}, + {field: 'lingala', title: 'Lingála', continent: 'Afrique'}, + {field: 'wolof', title: 'Wolof', continent: 'Afrique'}, + {field: 'swahili', title: 'Kiswahili', continent: 'Afrique'}, + {field: 'hausa', title: 'Hausa', continent: 'Afrique'}, + {field: 'arabe', title: 'العربية', continent: 'Afrique'}, + {field: 'oromo', title: 'Oromoo', continent: 'Afrique'}, + {field: 'igbo', title: 'Igbo', continent: 'Afrique'}, + {field: 'zoulou', title: 'isiZulu', continent: 'Afrique'}, + {field: 'malgache', title: 'Malagasy', continent: 'Afrique'}, + {field: 'xhosa', title: 'isiXhosa', continent: 'Afrique'}, + {field: 'tswana', title: 'Setswana', continent: 'Afrique'}, + {field: 'tsonga', title: 'Xitsonga', continent: 'Afrique'}, + {field: 'sesotho', title: 'Sesotho', continent: 'Afrique'}, + // Asie + {field: 'japonais', title: '日本語', continent: 'Asie'}, + {field: 'coreen', title: '한국어', continent: 'Asie'}, + // Europe + {field: 'anglais', title: 'English', continent: 'Europe'}, + {field: 'francais', title: 'Français', continent: 'Europe'}, + {field: 'espagnol', title: 'Español', continent: 'Europe'}, + {field: 'allemand', title: 'Deutsch', continent: 'Europe'}, + {field: 'italien', title: 'Italiano', continent: 'Europe'}, + {field: 'portugais', title: 'Português', continent: 'Europe'}, ] const langToArray = parole => { @@ -106,10 +125,13 @@ const langToArray = parole => { return TRAD_FIELDS .filter(({field}) => parole.traductions[field]) - .map(({field, title}) => ({field, title, lang: parole.traductions[field]})) + .map(({field, title, continent}) => ({field, title, continent, lang: parole.traductions[field]})) } const BROWSER_LANG_TO_FIELD = { + yo: 'yoruba', ln: 'lingala', wo: 'wolof', sw: 'swahili', ha: 'hausa', + ar: 'arabe', om: 'oromo', ig: 'igbo', zu: 'zoulou', mg: 'malgache', + xh: 'xhosa', tn: 'tswana', ts: 'tsonga', st: 'sesotho', ja: 'japonais', ko: 'coreen', en: 'anglais', fr: 'francais', es: 'espagnol', de: 'allemand', it: 'italien', pt: 'portugais', } @@ -123,7 +145,6 @@ export default function Teks({parole}) { const coverFmt = formatKuveti(parole.couverture) const [tab, setTab] = useState(0) const [, setCurrentTrack] = useCurrentTrack() - const options = ['Transcription', ...langArray.map(({title}) => title)] useEffect(() => { const isBrowser = () => typeof window !== 'undefined' @@ -247,18 +268,45 @@ export default function Teks({parole}) { )} - - {options.map((label, index) => ( - setTab(index)} - /> - ))} + + setTab(0)} + /> + {CONTINENTS.map(continent => { + const items = langArray + .map((item, index) => ({...item, index})) + .filter(item => item.continent === continent) + + if (items.length === 0) { + return null + } + + return ( + + + {continent} + + + {items.map(({title, index}) => ( + setTab(index + 1)} + /> + ))} + + + ) + })} {tab === 0 && ( <>