mirror of
https://github.com/ArthurDanjou/artsite.git
synced 2026-02-01 18:29:35 +01:00
Add spanish
This commit is contained in:
@@ -10,50 +10,58 @@ const navs = [
|
|||||||
{
|
{
|
||||||
label: {
|
label: {
|
||||||
en: 'home',
|
en: 'home',
|
||||||
fr: 'accueil'
|
fr: 'accueil',
|
||||||
|
es: 'inicio'
|
||||||
},
|
},
|
||||||
to: '/',
|
to: '/',
|
||||||
icon: 'i-ph-house-line-duotone',
|
icon: 'i-ph-house-line-duotone',
|
||||||
shortcut: {
|
shortcut: {
|
||||||
en: 'h',
|
en: 'h',
|
||||||
fr: 'a'
|
fr: 'a',
|
||||||
|
es: 'i'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: {
|
label: {
|
||||||
en: 'uses',
|
en: 'uses',
|
||||||
fr: 'usages'
|
fr: 'usages',
|
||||||
|
es: 'usos'
|
||||||
},
|
},
|
||||||
to: '/uses',
|
to: '/uses',
|
||||||
icon: 'i-ph-backpack-duotone',
|
icon: 'i-ph-backpack-duotone',
|
||||||
shortcut: {
|
shortcut: {
|
||||||
en: 'u',
|
en: 'u',
|
||||||
fr: 'u'
|
fr: 'u',
|
||||||
|
es: 'u'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: {
|
label: {
|
||||||
en: 'writings',
|
en: 'writings',
|
||||||
fr: 'écrits'
|
fr: 'écrits',
|
||||||
|
es: 'escritos'
|
||||||
},
|
},
|
||||||
to: '/writings',
|
to: '/writings',
|
||||||
icon: 'i-ph-books-duotone',
|
icon: 'i-ph-books-duotone',
|
||||||
shortcut: {
|
shortcut: {
|
||||||
en: 'w',
|
en: 'w',
|
||||||
fr: 'e'
|
fr: 'e',
|
||||||
|
es: 'e'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: {
|
label: {
|
||||||
en: 'resume',
|
en: 'resume',
|
||||||
fr: 'cv'
|
fr: 'cv',
|
||||||
|
es: 'currículum'
|
||||||
},
|
},
|
||||||
to: config.public.cloud.resume,
|
to: config.public.cloud.resume,
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
icon: 'i-ph-address-book-duotone',
|
icon: 'i-ph-address-book-duotone',
|
||||||
shortcut: {
|
shortcut: {
|
||||||
en: 'r',
|
en: 'r',
|
||||||
fr: 'c'
|
fr: 'c',
|
||||||
|
es: 'c'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -69,20 +77,30 @@ async function toggleTheme() {
|
|||||||
document.body.style.animation = ''
|
document.body.style.animation = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeLocale() {
|
const { locale, setLocale, locales, t, availableLocales } = useI18n()
|
||||||
|
|
||||||
|
async function changeLocale(newLocale?: string) {
|
||||||
document.body.style.animation = 'switch-on .2s'
|
document.body.style.animation = 'switch-on .2s'
|
||||||
await new Promise(resolve => setTimeout(resolve, 200))
|
await new Promise(resolve => setTimeout(resolve, 200))
|
||||||
|
|
||||||
await setLocale(locale.value === 'en' ? 'fr' : 'en')
|
if (!newLocale) {
|
||||||
|
const currentLocaleIndex = availableLocales.findIndex(l => l === locale.value)
|
||||||
|
const nextLocaleIndex = (currentLocaleIndex + 1) % availableLocales.length
|
||||||
|
newLocale = availableLocales[nextLocaleIndex]
|
||||||
|
}
|
||||||
|
|
||||||
|
await setLocale(newLocale ?? 'en')
|
||||||
document.body.style.animation = 'switch-off .2s'
|
document.body.style.animation = 'switch-off .2s'
|
||||||
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 200))
|
await new Promise(resolve => setTimeout(resolve, 200))
|
||||||
document.body.style.animation = ''
|
document.body.style.animation = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const router = useRouter()
|
const lang = ref(locale.value)
|
||||||
const { locale, setLocale, locales, t } = useI18n()
|
watch(lang, () => changeLocale(lang.value))
|
||||||
const currentLocale = computed(() => locales.value.filter(l => l.code === locale.value)[0])
|
const currentLocale = computed(() => locales.value.filter(l => l.code === locale.value)[0])
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
defineShortcuts({
|
defineShortcuts({
|
||||||
h: () => router.push('/'),
|
h: () => router.push('/'),
|
||||||
a: () => router.push('/'),
|
a: () => router.push('/'),
|
||||||
@@ -110,7 +128,7 @@ defineShortcuts({
|
|||||||
v-for="nav in navs"
|
v-for="nav in navs"
|
||||||
:key="nav.label.en"
|
:key="nav.label.en"
|
||||||
:shortcuts="[nav.shortcut[locale]]"
|
:shortcuts="[nav.shortcut[locale]]"
|
||||||
:text="nav.label[locale]"
|
:text="nav.label[locale]!"
|
||||||
>
|
>
|
||||||
<UButton
|
<UButton
|
||||||
:icon="nav.icon"
|
:icon="nav.icon"
|
||||||
@@ -139,15 +157,23 @@ defineShortcuts({
|
|||||||
<UTooltip
|
<UTooltip
|
||||||
:shortcuts="['l']"
|
:shortcuts="['l']"
|
||||||
:text="t('language')"
|
:text="t('language')"
|
||||||
|
:popper="{ placement: 'right' }"
|
||||||
>
|
>
|
||||||
<UButton
|
<USelectMenu
|
||||||
:icon="currentLocale!.icon"
|
v-model="lang"
|
||||||
aria-label="switch language"
|
:options="locales"
|
||||||
color="white"
|
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="solid"
|
option-attribute="code"
|
||||||
@click.prevent="changeLocale()"
|
value-attribute="code"
|
||||||
/>
|
variant="outline"
|
||||||
|
>
|
||||||
|
<template #leading>
|
||||||
|
<UIcon
|
||||||
|
:name="currentLocale!.icon"
|
||||||
|
class="w-5 h-5"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
</UTooltip>
|
</UTooltip>
|
||||||
</ClientOnly>
|
</ClientOnly>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -191,6 +217,10 @@ defineShortcuts({
|
|||||||
"fr": {
|
"fr": {
|
||||||
"theme": "changer de thème",
|
"theme": "changer de thème",
|
||||||
"language": "changer de langue"
|
"language": "changer de langue"
|
||||||
|
},
|
||||||
|
"es": {
|
||||||
|
"theme": "cambiar tema",
|
||||||
|
"language": "cambiar idioma"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const { locale } = useI18n()
|
|||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
{{ locale === 'en' ? item.description.en : item.description.fr }}
|
{{ locale === 'en' ? item.description.en : locale === 'es' ? item.description.es : item.description.fr }}
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ J'ai également appris d'autres technologies importantes, telles que
|
|||||||
compléter"} mes connaissances.
|
compléter"} mes connaissances.
|
||||||
|
|
||||||
Je suis :hover-text{hover="Je dois toujours chercher à être à jour 🖥️" position="top" text="constamment"} dans
|
Je suis :hover-text{hover="Je dois toujours chercher à être à jour 🖥️" position="top" text="constamment"} dans
|
||||||
l'apprentissage de nouvelles choses, de la technologie à la finance en passant par l'entrepreneuriat. J'aime :
|
l'apprentissage de nouvelles choses, de la technologie à la finance en passant par l'entrepreneuriat. J'aime
|
||||||
hover-text{hover="J'aime partager et aider les autres 🫂" text="partager"} mes connaissances et apprendre de nouveaux
|
:hover-text{hover="J'aime partager et aider les autres 🫂" text="partager"} mes connaissances et apprendre de nouveaux
|
||||||
théorèmes et technologies. Je suis une personne :hover-text{hover="Je cherche à découvrir de nouvelles choses" text="
|
théorèmes et technologies. Je suis une personne :hover-text{hover="Je cherche à découvrir de nouvelles choses" text="
|
||||||
curieuse"} et désireuse de continuer à apprendre et à grandir tout au long de ma vie.
|
curieuse"} et désireuse de continuer à apprendre et à grandir tout au long de ma vie.
|
||||||
|
|
||||||
|
|||||||
@@ -59,10 +59,16 @@ export default defineNuxtConfig({
|
|||||||
code: 'en',
|
code: 'en',
|
||||||
iso: 'en-EN',
|
iso: 'en-EN',
|
||||||
icon: 'i-twemoji-flag-united-kingdom'
|
icon: 'i-twemoji-flag-united-kingdom'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
code: 'fr',
|
code: 'fr',
|
||||||
iso: 'fr-FR',
|
iso: 'fr-FR',
|
||||||
icon: 'i-twemoji-flag-france'
|
icon: 'i-twemoji-flag-france'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'es',
|
||||||
|
iso: 'es-ES',
|
||||||
|
icon: 'i-twemoji-flag-spain'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
defaultLocale: 'en'
|
defaultLocale: 'en'
|
||||||
|
|||||||
Reference in New Issue
Block a user