feat: add pt-BR/ja/ko to translation submission form
This commit is contained in:
@@ -76,7 +76,7 @@ function AjouteTradiksyon({showSwitch, disableSwitch, tradiksyonOtomatik, setTra
|
|||||||
aria-haspopup='true'
|
aria-haspopup='true'
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
>
|
>
|
||||||
Ajouter une traduction <br /> 🇺🇸 🇫🇷 🇪🇸 🇩🇪 🇮🇹
|
Ajouter une traduction <br /> 🇺🇸 🇫🇷 🇪🇸 🇩🇪 🇮🇹 🇧🇷 🇯🇵 🇰🇷
|
||||||
</Button>
|
</Button>
|
||||||
<StyledMenu
|
<StyledMenu
|
||||||
keepMounted
|
keepMounted
|
||||||
@@ -123,6 +123,27 @@ function AjouteTradiksyon({showSwitch, disableSwitch, tradiksyonOtomatik, setTra
|
|||||||
}}
|
}}
|
||||||
onClick={handleClose}
|
onClick={handleClose}
|
||||||
>🇮🇹 Italien</StyledMenuItem>
|
>🇮🇹 Italien</StyledMenuItem>
|
||||||
|
<StyledMenuItem
|
||||||
|
id='pt'
|
||||||
|
classes={{
|
||||||
|
root: classes.root
|
||||||
|
}}
|
||||||
|
onClick={handleClose}
|
||||||
|
>🇧🇷 Portugais</StyledMenuItem>
|
||||||
|
<StyledMenuItem
|
||||||
|
id='ja'
|
||||||
|
classes={{
|
||||||
|
root: classes.root
|
||||||
|
}}
|
||||||
|
onClick={handleClose}
|
||||||
|
>🇯🇵 Japonais</StyledMenuItem>
|
||||||
|
<StyledMenuItem
|
||||||
|
id='ko'
|
||||||
|
classes={{
|
||||||
|
root: classes.root
|
||||||
|
}}
|
||||||
|
onClick={handleClose}
|
||||||
|
>🇰🇷 Coréen</StyledMenuItem>
|
||||||
</StyledMenu>
|
</StyledMenu>
|
||||||
</Root>
|
</Root>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -65,6 +65,21 @@ const textLabels = {
|
|||||||
title: 'Traduzione',
|
title: 'Traduzione',
|
||||||
help: 'Traduzione del testo',
|
help: 'Traduzione del testo',
|
||||||
emoji: '🇮🇹'
|
emoji: '🇮🇹'
|
||||||
|
},
|
||||||
|
pt: {
|
||||||
|
title: 'Tradução',
|
||||||
|
help: 'Tradução da letra',
|
||||||
|
emoji: '🇧🇷'
|
||||||
|
},
|
||||||
|
ja: {
|
||||||
|
title: '翻訳',
|
||||||
|
help: '歌詞の翻訳',
|
||||||
|
emoji: '🇯🇵'
|
||||||
|
},
|
||||||
|
ko: {
|
||||||
|
title: '번역',
|
||||||
|
help: '가사 번역',
|
||||||
|
emoji: '🇰🇷'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +93,7 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
|
|||||||
const {data: session} = useSession()
|
const {data: session} = useSession()
|
||||||
const {jwt, user} = session
|
const {jwt, user} = session
|
||||||
const [teksEkri, setTeksEkri] = useState({awtis: '', tit: '', transkripsyon: ''})
|
const [teksEkri, setTeksEkri] = useState({awtis: '', tit: '', transkripsyon: ''})
|
||||||
const [tradiksyon, setTradiksyon] = useState({fr: '', en: '', es: '', de: '', it: ''})
|
const [tradiksyon, setTradiksyon] = useState({fr: '', en: '', es: '', de: '', it: '', pt: '', ja: '', ko: ''})
|
||||||
const [kiChawLang, setKiChwalang] = useState(['fr'])
|
const [kiChawLang, setKiChwalang] = useState(['fr'])
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
const [success, setSuccess] = useState('')
|
const [success, setSuccess] = useState('')
|
||||||
@@ -112,7 +127,7 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
|
|||||||
const handleClick = async () => {
|
const handleClick = async () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const {awtis, tit, transkripsyon} = teksEkri
|
const {awtis, tit, transkripsyon} = teksEkri
|
||||||
const {fr, en, es, de, it} = tradiksyon
|
const {fr, en, es, de, it, pt, ja, ko} = tradiksyon
|
||||||
|
|
||||||
if (teksEkri.awtis === '' || teksEkri.tit === '' || teksEkri.transkripsyon === '') {
|
if (teksEkri.awtis === '' || teksEkri.tit === '' || teksEkri.transkripsyon === '') {
|
||||||
setError({message: 'Certains champs sont obligatoires'})
|
setError({message: 'Certains champs sont obligatoires'})
|
||||||
@@ -139,7 +154,10 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
|
|||||||
anglais: en === '' ? null : en,
|
anglais: en === '' ? null : en,
|
||||||
espagnol: es === '' ? null : es,
|
espagnol: es === '' ? null : es,
|
||||||
allemand: de === '' ? null : de,
|
allemand: de === '' ? null : de,
|
||||||
italien: it === '' ? null : it
|
italien: it === '' ? null : it,
|
||||||
|
portugais: pt === '' ? null : pt,
|
||||||
|
japonais: ja === '' ? null : ja,
|
||||||
|
coreen: ko === '' ? null : ko
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
@@ -184,7 +202,10 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
|
|||||||
anglais: en === '' ? null : en,
|
anglais: en === '' ? null : en,
|
||||||
espagnol: es === '' ? null : es,
|
espagnol: es === '' ? null : es,
|
||||||
allemand: de === '' ? null : de,
|
allemand: de === '' ? null : de,
|
||||||
italien: it === '' ? null : it
|
italien: it === '' ? null : it,
|
||||||
|
portugais: pt === '' ? null : pt,
|
||||||
|
japonais: ja === '' ? null : ja,
|
||||||
|
coreen: ko === '' ? null : ko
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
@@ -211,7 +232,7 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
|
|||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
setTeksEkri({awtis: '', tit: '', transkripsyon: ''})
|
setTeksEkri({awtis: '', tit: '', transkripsyon: ''})
|
||||||
setTradiksyon({fr: '', en: '', es: '', de: '', it: ''})
|
setTradiksyon({fr: '', en: '', es: '', de: '', it: '', pt: '', ja: '', ko: ''})
|
||||||
setKiChwalang(['fr'])
|
setKiChwalang(['fr'])
|
||||||
setCurrentTeksId(null)
|
setCurrentTeksId(null)
|
||||||
setTradiksyonOtomatik(false)
|
setTradiksyonOtomatik(false)
|
||||||
@@ -244,7 +265,10 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
|
|||||||
en: selectedTeks?.traductions?.anglais || '',
|
en: selectedTeks?.traductions?.anglais || '',
|
||||||
es: selectedTeks?.traductions?.espagnol || '',
|
es: selectedTeks?.traductions?.espagnol || '',
|
||||||
de: selectedTeks?.traductions?.allemand || '',
|
de: selectedTeks?.traductions?.allemand || '',
|
||||||
it: selectedTeks?.traductions?.italien || ''
|
it: selectedTeks?.traductions?.italien || '',
|
||||||
|
pt: selectedTeks?.traductions?.portugais || '',
|
||||||
|
ja: selectedTeks?.traductions?.japonais || '',
|
||||||
|
ko: selectedTeks?.traductions?.coreen || ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const jennLangId = () => {
|
const jennLangId = () => {
|
||||||
@@ -270,6 +294,18 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
|
|||||||
ids.push('it')
|
ids.push('it')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectedTeks?.traductions?.portugais) {
|
||||||
|
ids.push('pt')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedTeks?.traductions?.japonais) {
|
||||||
|
ids.push('ja')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedTeks?.traductions?.coreen) {
|
||||||
|
ids.push('ko')
|
||||||
|
}
|
||||||
|
|
||||||
return ids
|
return ids
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +409,7 @@ function EkriTeks({canAutoTranslate, selectedTeks, setSelectedTeks}) {
|
|||||||
</form>
|
</form>
|
||||||
<AjouteTradiksyon
|
<AjouteTradiksyon
|
||||||
showSwitch={Boolean(canAutoTranslate) && Boolean(!currentTeksId)}
|
showSwitch={Boolean(canAutoTranslate) && Boolean(!currentTeksId)}
|
||||||
disableSwitch={tradiksyon.fr === '' || tradiksyon.en !== '' || tradiksyon.es !== '' || tradiksyon.de !== '' || tradiksyon.it !== ''}
|
disableSwitch={tradiksyon.fr === '' || tradiksyon.en !== '' || tradiksyon.es !== '' || tradiksyon.de !== '' || tradiksyon.it !== '' || tradiksyon.pt !== '' || tradiksyon.ja !== '' || tradiksyon.ko !== ''}
|
||||||
tradiksyonOtomatik={tradiksyonOtomatik}
|
tradiksyonOtomatik={tradiksyonOtomatik}
|
||||||
setTradiksyonOtomatik={setTradiksyonOtomatik}
|
setTradiksyonOtomatik={setTradiksyonOtomatik}
|
||||||
chwaLang={kiChawLang}
|
chwaLang={kiChawLang}
|
||||||
|
|||||||
Reference in New Issue
Block a user