11---
2+ import { getLangFromUrl , useTranslations } from " ~/i18n/utils"
23import IconLeft from " ~icons/tabler/arrow-big-left-lines-filled"
34import IconRight from " ~icons/tabler/arrow-big-right-lines-filled"
45
@@ -9,6 +10,7 @@ interface Props {
910}
1011
1112const { lang, previous, next } = Astro .props
13+ const t = useTranslations (lang as " es" | " en" )
1214const isNextDisabled = true
1315
1416const btnBaseClass =
@@ -21,7 +23,7 @@ const iconBaseClass = "block h-6 w-6 rounded-lg transition-all duration-200 tran
2123<nav class =" not-prose mt-auto flex w-full items-center justify-between pb-2" aria-label =" Navegación de lecciones" >
2224 <a
2325 href ={ previous ? ` /${lang }/${previous .slug } ` : undefined }
24- aria-label ={ previous ? ` Anterior : ${previous .title }` : undefined }
26+ aria-label ={ previous ? ` ${ t ( " nav.previous " )} : ${previous .title }` : undefined }
2527 aria-disabled ={ ! previous }
2628 class ={ btnBaseClass }
2729 >
@@ -30,21 +32,21 @@ const iconBaseClass = "block h-6 w-6 rounded-lg transition-all duration-200 tran
3032 </span >
3133 <div class =" flex flex-col text-left" >
3234 <span class:list ={ [" text-md font-medium" , previous ? " text-yellow" : " text-[#ccc]" ]} >
33- Anterior
35+ { t ( " nav.previous " ) }
3436 </span >
3537 <span class =" text-xs text-[#ccc]" >{ previous ?.title || " -" } </span >
3638 </div >
3739 </a >
3840 <a
3941 id =" next-lesson-btn"
4042 href ={ next ? ` /${lang }/${next .slug } ` : undefined }
41- aria-label ={ next ? ` Siguiente : ${next .title }` : undefined }
43+ aria-label ={ next ? ` ${ t ( " nav.next " )} : ${next .title }` : undefined }
4244 aria-disabled ={ isNextDisabled }
4345 class ={ nextBtnClass }
4446 >
4547 <div class =" flex flex-col text-right" >
4648 <span class:list ={ [" text-md font-medium" , next ? " text-yellow" : " text-[#ccc]" ]} >
47- Siguiente
49+ { t ( " nav.next " ) }
4850 </span >
4951 <span class =" text-xs text-[#ccc]" >{ next ?.title || " -" } </span >
5052 </div >
@@ -57,6 +59,7 @@ const iconBaseClass = "block h-6 w-6 rounded-lg transition-all duration-200 tran
5759<script >
5860 import { db } from "~/lib/stores/editor-store"
5961 import { toast } from "~/utils/toasts"
62+ import { useTranslations, getLangFromUrl } from "~/i18n/utils"
6063
6164 const initNextButton = async () => {
6265 const btn = document.getElementById("next-lesson-btn") as HTMLAnchorElement | null
@@ -65,9 +68,11 @@ const iconBaseClass = "block h-6 w-6 rounded-lg transition-all duration-200 tran
6568 btn.addEventListener("click", (e) => {
6669 if (btn.ariaDisabled === "true") {
6770 e.preventDefault()
71+ const currentLang = getLangFromUrl(new URL(window.location.href))
72+ const t = useTranslations(currentLang)
6873 toast.info(
69- "Ejecuta el código" ,
70- "El código debe ser ejecutado al menos una vez para poder avanzar a la siguiente sección" ,
74+ t("toast.run_required_title") ,
75+ t("toast.run_required_desc") ,
7176 )
7277 }
7378 })
0 commit comments