From 57cb8933e213db6bdd2612eaaa33fc35741c364b Mon Sep 17 00:00:00 2001 From: juancmandev Date: Wed, 31 Jul 2024 16:42:52 -0600 Subject: [PATCH] configure locales, fix bugs --- src/components/navigation.tsx | 34 ++----------- .../es/a-better-way-for-consuming-content.mdx | 14 ++++++ ...ting-content-in-spanish-for-my-website.mdx | 11 ++++- src/content/pages/contact.mdx | 23 +++++---- src/content/pages/es/contacto.mdx | 38 ++++++++------- .../portfolio/es/build-a-fullstack-app.mdx | 16 +++++++ src/i18n/ui.ts | 48 +++++++++++++++---- src/i18n/utils.ts | 14 +++--- src/lib/utils.ts | 6 +-- src/pages/[...slug].astro | 2 +- src/pages/blog/[...slug].astro | 2 +- src/pages/es/[...slug].astro | 2 +- src/pages/es/feed.xml.ts | 31 ++++++++---- src/pages/es/videos/[...slug].astro | 2 +- src/pages/feed.xml.ts | 31 ++++++++---- src/pages/portfolio/[...slug].astro | 2 +- 16 files changed, 173 insertions(+), 103 deletions(-) create mode 100644 src/content/blog/es/a-better-way-for-consuming-content.mdx create mode 100644 src/content/portfolio/es/build-a-fullstack-app.mdx diff --git a/src/components/navigation.tsx b/src/components/navigation.tsx index f4aa3fc..0fdef7f 100644 --- a/src/components/navigation.tsx +++ b/src/components/navigation.tsx @@ -8,7 +8,7 @@ import { Info, Mail, } from "lucide-react"; -import { useTranslations, useTranslatedPath } from "@/i18n/utils"; +import { useTranslations } from "@/i18n/utils"; type TNavItem = { type: string; @@ -47,46 +47,22 @@ type Props = { lang: "en" | "es"; }; -const locales = { - en: { - navigation: "Navigation", - blog: { label: "Blog", to: "/blog" }, - portfolio: { label: "Portfolio", to: "/portfolio" }, - videos: { label: "Videos", to: "/es/videos" }, - microblog: { label: "Microblog", to: "/microblog" }, - resources: { label: "Resources", to: "/resources" }, - about: { label: "About", to: "/about" }, - contact: { label: "Contact", to: "/contact" }, - }, - es: { - navigation: "Navegación", - blog: { label: "Blog", to: "/es/blog" }, - portfolio: { label: "Portfolio", to: "/es/portfolio" }, - videos: { label: "Videos", to: "/es/videos" }, - microblog: { label: "Microblog", to: "/microblog" }, - resources: { label: "Recursos", to: "/es/recursos" }, - about: { label: "Acerca de", to: "/es/acerca-de" }, - contact: { label: "Contacto", to: "/es/contacto" }, - }, -} as const; - export default function Navigation(props: Props) { - const t = useTranslations(props.lang); - const translatePath = useTranslatedPath(props.lang); + const t = useTranslations(props.lang as any); return (