diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-04-21 22:54:15 +0200 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-04-21 22:54:15 +0200 |
| commit | b4ef1a0d288565f744bf754af456c4f60da99ca7 (patch) | |
| tree | 907c88a2e59370a0b06dbd60aa1cc297b67b004b | |
| parent | e96af5ce5e8dd00cf8a31d4812f416583defa449 (diff) | |
Refactor localization: remove i18n support and update layouts to use static text
| -rw-r--r-- | astro.config.mjs | 10 | ||||
| -rw-r--r-- | src/i18n/en.json | 89 | ||||
| -rw-r--r-- | src/i18n/index.ts | 34 | ||||
| -rw-r--r-- | src/layouts/ContactPageLayout.astro | 25 | ||||
| -rw-r--r-- | src/layouts/GeoblockedPageLayout.astro | 45 | ||||
| -rw-r--r-- | src/layouts/HomePageLayout.astro | 38 | ||||
| -rw-r--r-- | src/layouts/Layout.astro | 25 | ||||
| -rw-r--r-- | src/layouts/PortfolioPageLayout.astro | 5 | ||||
| -rw-r--r-- | src/layouts/TrajectoryPageLayout.astro | 4 | ||||
| -rw-r--r-- | src/pages/en/contact.astro | 5 | ||||
| -rw-r--r-- | src/pages/en/index.astro | 5 | ||||
| -rw-r--r-- | src/pages/en/portfolio.astro | 5 | ||||
| -rw-r--r-- | src/pages/en/trajectory.astro | 5 | ||||
| -rw-r--r-- | src/pages/geoblocked.astro | 5 | ||||
| -rw-r--r-- | src/partials/Footer.astro | 4 | ||||
| -rw-r--r-- | src/partials/Header.astro | 21 |
16 files changed, 103 insertions, 222 deletions
diff --git a/astro.config.mjs b/astro.config.mjs index 523b075..19df8a3 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -2,22 +2,12 @@ import sitemap from "@astrojs/sitemap"; import { defineConfig } from "astro/config"; import mdx from "@astrojs/mdx"; -import { DEFAULT_LANGUAGE, LANGUAGE_CODES } from "./src/i18n"; import icon from "astro-icon"; export default defineConfig({ compressHTML: true, site: "https://www.costas.dev", - i18n: { - defaultLocale: DEFAULT_LANGUAGE, - locales: LANGUAGE_CODES, - routing: { - prefixDefaultLocale: false, - fallbackType: "redirect", - redirectToDefaultLocale: true, - }, - }, integrations: [ sitemap({ priority: 0.5, diff --git a/src/i18n/en.json b/src/i18n/en.json deleted file mode 100644 index 6cdebe1..0000000 --- a/src/i18n/en.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "header": { - "home": "Home", - "trajectory": "Trajectory", - "portfolio": "Portfolio", - "blog": "Blog", - "contact": "Contact" - }, - "footer": { - "copyright": "All rights reserved.", - "contentLicencedUnder": "Unless otherwise stated, the content of this site is licensed under", - "sourceCodeAvailableOn": "Source code for this site is available on", - "andIsLicencedUnder": "and is licenced under", - "eupl": "European Union Public Licence" - }, - "contactPage": { - "title": "Contact", - "description": "The ways to contact me, either by email, phone or social networks.", - "headline": "Get in touch with me!", - "enableJs": "JavaScript must be enabled to view the email address and phone number. This is done to prevent scrapers and spam.", - "intro": "The easiest way to contact me is through my email address: <a href=\"#\" id=\"email-addr\">Enable JS</a>. You can also use <a href=\"https://wa.me/message/W7T7L4EZAELQI1\">WhatsApp</a> with the phone number <a href=\"#\" id=\"phone-number\">Enable JS</a>.", - "socialMedia": "You can also find me on some social networks:" - }, - "homePage": { - "title": "Home", - "description": "Homepage of my website", - "welcome": "Welcome to my website. My name is Ariel, and here you will find information about me and my projects.", - "whoAmI": "Who am I?", - "whoAmIDesc": "I am a web developer who likes to learn new things and share knowledge. I enjoy programming, web design, and creativity. I love creating new things and learning from others.", - "moreAboutMe": "More about me", - "whatIDo": "What do I do?", - "whatIDoDesc": "I currently work as a software developer and Cloud administrator at a technology company. I develop web applications in PHP and deploy them in the cloud securely and efficiently.", - "myPortfolio": "My portfolio", - "latestBlogPosts": "Latest blog posts", - "viewAllPosts": "View all posts" - }, - "trajectoryPage": { - "title": "Trajectory", - "description": "My trajectory as a software developer, with information about my education, work experience and projects I have worked on.", - "headline": "My trajectory as a developer", - "intro": "I am a software developer living in Vigo, Spain. I love technology and I enjoy learning new things. I am professionally dedicated to software development in all its aspects: from architecture design, implementation and production deployment, to other aspects such as user experience, accessibility and security.", - "techTitle": "Technologies I master", - "techDescription1": "I mainly master the Microsoft ecosystem: .NET (C#), ASP.NET Core, SQL Server, Azure and Azure DevOps. I also have experience with other languages and technologies, such as PHP, Python and Java. Additionally, I have frontend knowledge with HTML5, CSS3, JavaScript and TypeScript.", - "techDescription2": "I also have experience with DevOps tools such as Docker, Kubernetes, Terraform and GitHub Actions; as well as the Azure Cloud ecosystem.", - "educationTitle": "Education and credentials", - "efsetCert1": "Official EF SET C2 Proficient Certificate", - "efsetCert2": ": certifies my C2 English level, the highest according to the Common European Framework of Reference for Languages.", - "viewCertificate": "View certificate", - "azureDeveloperCert1": "Microsoft Certified: Azure Developer Associate", - "azureDeveloperCert2": ": certifies my knowledge in Azure application development.", - "viewCredential": "View credential", - "azureDevOpsCert1": "Microsoft Certified: Azure DevOps Engineer Expert", - "azureDevOpsCert2": ": certifies my knowledge in implementing DevOps methodologies in Azure with Azure DevOps and GitHub.", - "higherTechCert1": "Higher Technical Certificate in Multiplatform Application Development", - "higherTechCert2": ": higher vocational training degree, obtained at", - "higherTechCert3": "IES de Teis", - "higherTechCert4": "in Vigo.", - "experienceTitle": "Work experience", - "estelaria1": "Estelaria Solutions (Q3 2023 - present)", - "estelaria2": "Full-stack application development, mainly in PHP with Symfony, MongoDB and Vanilla JavaScript. In addition, I implemented a considerable number of improvements in usability, accessibility and performance.", - "estelaria3": "I am also responsible for managing the infrastructure on AWS, and implementing collaboration tools such as Jira and GitHub.", - "polygon1": "Internship at Polygon-E (Q2 2023)", - "polygon2": "I did my professional training internship at Polygon-E, where I developed several internal management applications with ASP.NET Core and Blazor, deploying on on-premise environments with Windows Server, IIS and SQL Server.", - "projectsTitle": "Projects", - "projectsDescription": "You can find the (public) projects I have worked on in <a href=\"/portfolio\">my portfolio</a> and on my <a href=\"https://github.com/arielcostas\">GitHub profile</a>." - }, - "portfolioPage": { - "title": "Portfolio", - "description": "A list of projects I have worked on in recent years, with the technologies used.", - "headline": "My portfolio", - "intro": "In this section, you will find a list of the projects I have worked on, both for third parties and my own. If you would like more information about any of them, please do not hesitate to <a href=\"/contact\">contact me</a>.", - "freelanceTitle": "Projects for third parties (freelance)", - "freelanceDesc": "I have developed projects for third parties by commission, the most notable being the following:", - "orderExtractorTitle": "Online Order Purchase Extractor", - "orderExtractorDesc": "Desktop application that extracts data about online orders from various platforms (such as WooCommerce, Amazon, and eBay). <a href=\"/portfolio/order-extractor\">More information</a>.", - "touristInfoTitle": "Tourist Information Point on Mobile Devices", - "touristInfoDesc": "Web application for tourist information, with QR codes, 360° content, and YouTube embedding. <a href=\"/portfolio/dynamic-tourist-info\">More information</a>.", - "wpConsultingTitle": "WordPress Consulting", - "wpConsultingDesc": "Maintenance, optimisation, and migration work for WordPress websites and WooCommerce online shops. <a href=\"/portfolio/wp-consulting\">More information</a>. <a href=\"/contact\">Contact</a>.", - "ownProjectsTitle": "My own projects", - "ownProjectsDesc": "Additionally, I have several personal projects that I have developed in my own time, some of which are active and open source.", - "personalWebTitle": "Personal Website", - "personalWebDesc": "Developed with Astro, a static site generator that lets you write content in Markdown and publish to the web with excellent performance. Deployed on Azure Static Web Apps.", - "mientrenoTitle": "MiEntreno (end-of-course project)", - "mientrenoDesc": "Web application for managing sports training, with a simple and easy-to-use interface. Developed with ASP.NET Core, Razor Pages, and SQL Server. <a href=\"/portfolio/mientreno\">More information</a>. <a href=\"https://github.com/arielcostas/mientreno\">Source code</a>.", - "vigo360Title": "Vigo 360", - "vigo360Desc": "Blog about Vigo and its surroundings, mainly focused on mobility and toponymy. Developed in Go, with a MySQL database and deployed on a VPS managed by myself. <a href=\"/portfolio/vigo-360\">More information</a>. <a href=\"https://github.com/arielcostas/vigo360\">Source code</a>. <a href=\"https://vigo360.es\">Website</a>." - } -} diff --git a/src/i18n/index.ts b/src/i18n/index.ts deleted file mode 100644 index 3e6083b..0000000 --- a/src/i18n/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -import Spanish from "./es.json"; -import English from "./en.json"; - -export const SHOW_DEFAULT_LANGUAGE = false; -export const DEFAULT_LANGUAGE = "es"; - -export type LanguageKeys = "es" | "en"; - -export const languages: Record<LanguageKeys, { code: string; name: string }> = { - es: { - code: "es", - name: "Español", - }, - en: { - code: "en", - name: "English", - }, -}; - -export const LANGUAGE_CODES = Object.keys(languages); - -export const useTranslations = (lang: string | undefined) => { - switch (lang) { - case languages.en.code: - return English; - case languages.es.code: - default: - return Spanish; - } -}; - -export function getUrlWithoutLocale(url: string) { - return url.replace(/\/[a-z]{2}\//, "/"); -} diff --git a/src/layouts/ContactPageLayout.astro b/src/layouts/ContactPageLayout.astro index c09969f..3a02293 100644 --- a/src/layouts/ContactPageLayout.astro +++ b/src/layouts/ContactPageLayout.astro @@ -1,18 +1,18 @@ --- -import { useTranslations } from "../i18n"; import Layout from "./Layout.astro"; -const t = useTranslations(Astro.currentLocale); - const schema = { "@context": "https://schema.org", "@type": "ContactPage", url: "https://www.costas.dev/contact", - headline: t.contactPage.headline, + headline: "Contacta conmigo", }; --- -<Layout title={t.contactPage.title} description={t.contactPage.description}> +<Layout + title="Contacto" + description="Las formas de ponerte en contacto conmigo, ya sea por correo electrónico, teléfono o redes sociales." +> <script is:inline type="application/ld+json" @@ -20,17 +20,24 @@ const schema = { set:html={JSON.stringify(schema)} /> - <h1>{t.contactPage.headline}</h1> + <h1>"Contacta conmigo"</h1> <noscript> <div role="alert" class="warning"> - {t.contactPage.enableJs} + Es necesario activar JavaScript para ver la dirección de correo + electrónico y el número de teléfono. Esto se hace para evitar scrapers y + spam. </div> </noscript> - <p set:html={t.contactPage.intro} /> + <p> + La forma más sencilla de contactar conmigo es a través de mi dirección de + correo electrónico: <a href="#" id="email-addr">Activa JS</a>. También + puedes usar <a href="https://wa.me/message/W7T7L4EZAELQI1">WhatsApp</a> con el + número de teléfono <a href="#" id="phone-number">Activa JS</a>. + </p> - <p>{t.contactPage.socialMedia}</p> + <p>También puedes encontrarme en algunas redes sociales:</p> <dl> <dt>GitHub</dt> diff --git a/src/layouts/GeoblockedPageLayout.astro b/src/layouts/GeoblockedPageLayout.astro new file mode 100644 index 0000000..58c78b5 --- /dev/null +++ b/src/layouts/GeoblockedPageLayout.astro @@ -0,0 +1,45 @@ +--- +import Layout from "./Layout.astro"; +--- + +<Layout + title="Geoblocked" + description="Access to this page is restricted, learn why." + empty +> + <Fragment slot="head-jsonld"> + <meta name="robots" content="noindex" /> + </Fragment> + + <h1>Geo-blocked</h1> + <p> + This page is purposely blocked for users on your region due to ethical + concerns, spam or abuse (or a combination of all these). + </p> + + <h2>Blocked countries</h2> + <ul> + <li>(US) United States of America - And colonies</li> + <li>(PR) Puerto Rico</li> + <li>(GU) Guam</li> + <li>(AS) American Samoa</li> + <li>(VI) U.S. Virgin Islands</li> + <li>(MP) Northern Mariana Islands</li> + <br /> + <li>(SV) El Salvador</li> + <li>(RU) Russian Federation</li> + <li>(BY) Belarus</li> + <br /> + <li>(IL) Israel</li> + <li>(HU) Hungary</li> + <li>(TR) Turkey</li> + <li>(CN) China</li> + <li>(SA) Saudi Arabia</li> + </ul> + + <p> + I am open to adding more countries to the list or removing them at any time. + I am aware of many other countries that have committed human rights abuses, + but these are the ones more likely to have users on this website. + </p> +</Layout> diff --git a/src/layouts/HomePageLayout.astro b/src/layouts/HomePageLayout.astro index 0906a11..e243c6e 100644 --- a/src/layouts/HomePageLayout.astro +++ b/src/layouts/HomePageLayout.astro @@ -1,24 +1,21 @@ --- import { getCollection } from "astro:content"; import Layout from "./Layout.astro"; -import { useTranslations } from "../i18n"; const blogCollection = (await getCollection("blog")).sort((a, b) => { return b.data.publishedAt.getTime() - a.data.publishedAt.getTime(); }); -const t = useTranslations(Astro.currentLocale); - const schema = { "@context": "http://schema.org", "@type": "WebSite", id: "https://www.costas.dev/", url: "https://www.costas.dev/", - headline: t.homePage.title, + headline: "Ariel Costas - Desarrollador web", }; --- -<Layout title={t.homePage.title} description={t.homePage.description}> +<Layout title="Inicio" description="Página de inicio de mi web"> <script is:inline type="application/ld+json" @@ -26,18 +23,29 @@ const schema = { set:html={JSON.stringify(schema)} /> - <h1>{t.homePage.title}</h1> - <p>{t.homePage.welcome}</p> + <h1>Inicio</h1> + <p> + Te doy la bienvenida a mi web. Me llamo Ariel, y aquí encontrarás + información sobre mí y mis proyectos. + </p> - <h2>{t.homePage.whoAmI}</h2> - <p>{t.homePage.whoAmIDesc}</p> - <a href="/trajectory">{t.homePage.moreAboutMe}</a> + <h2>¿Quién soy?</h2> + <p> + Soy un desarrollador web que le gusta aprender cosas nuevas y compartir su + conocimiento. Me gusta la programación, el diseño web y la creatividad. Me + encanta crear cosas nuevas y aprender de los demás. + </p> + <a href="/trajectory">Más información sobre mí</a> - <h2>{t.homePage.whatIDo}</h2> - <p>{t.homePage.whatIDoDesc}</p> - <a href="/portfolio">{t.homePage.myPortfolio}</a> + <h2>¿Qué hago?</h2> + <p> + Actualmente trabajo como desarrollador de software y administrador Cloud en + una empresa de tecnología. Me encargo de desarrollar aplicaciones web en PHP + y desplegarlas en la nube de forma segura y eficiente. + </p> + <a href="/portfolio">Mi portfolio</a> - <h2>{t.homePage.latestBlogPosts}</h2> + <h2>Últimas entradas del blog</h2> <ul> { blogCollection.slice(0, 5).map((p) => { @@ -55,5 +63,5 @@ const schema = { }) } </ul> - <a href="/blog">{t.homePage.viewAllPosts}</a> + <a href="/blog">Ver todas las entradas</a> </Layout> diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 30251ae..97115b5 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -3,16 +3,14 @@ import "@fontsource/beiruti"; import "@fontsource-variable/sen"; import Header from "../partials/Header.astro"; import Footer from "../partials/Footer.astro"; -import { getAbsoluteLocaleUrl } from "astro:i18n"; -import { getUrlWithoutLocale } from "../i18n"; interface Props { title: string; description: string; + empty?: boolean; } -const { title, description } = Astro.props; -const urlWithoutLocale = getUrlWithoutLocale(Astro.url.pathname); +const { title, description, empty } = Astro.props; --- <!doctype html> @@ -23,21 +21,6 @@ const urlWithoutLocale = getUrlWithoutLocale(Astro.url.pathname); <meta name="viewport" content="width=device-width" /> <link rel="canonical" href={Astro.url.toString().replace(/\.html$/, "")} /> - <link - rel="alternate" - hreflang="es" - href={getAbsoluteLocaleUrl("es", urlWithoutLocale)} - /> - <link - rel="alternate" - hreflang="en" - href={getAbsoluteLocaleUrl("en", urlWithoutLocale)} - /> - <link - rel="alternate" - hreflang="x-default" - href={getAbsoluteLocaleUrl("es", urlWithoutLocale)} - /> <link rel="alternate" type="application/rss+xml" href="/blog.xml" /> <link rel="sitemap" type="application/xml" href="/sitemap-index.xml" /> @@ -62,11 +45,11 @@ const urlWithoutLocale = getUrlWithoutLocale(Astro.url.pathname); <slot name="head-jsonld" /> </head> <body> - <Header /> + {empty ? null : <Header />} <main> <slot /> </main> - <Footer /> + {empty ? null : <Footer />} </body> </html> diff --git a/src/layouts/PortfolioPageLayout.astro b/src/layouts/PortfolioPageLayout.astro index 88f8614..c2d2b38 100644 --- a/src/layouts/PortfolioPageLayout.astro +++ b/src/layouts/PortfolioPageLayout.astro @@ -1,10 +1,9 @@ --- +import t from "../i18n/es.json"; + import Layout from "./Layout.astro"; -import { useTranslations } from "../i18n"; import TechnologyBadge from "../partials/TechnologyBadge.astro"; -const t = useTranslations(Astro.currentLocale); - const schema = { "@context": "https://schema.org", "@type": "WebPage", diff --git a/src/layouts/TrajectoryPageLayout.astro b/src/layouts/TrajectoryPageLayout.astro index a5bfb46..9a0bd53 100644 --- a/src/layouts/TrajectoryPageLayout.astro +++ b/src/layouts/TrajectoryPageLayout.astro @@ -1,9 +1,7 @@ --- -import { useTranslations } from "../i18n"; +import t from "../i18n/es.json"; import Layout from "./Layout.astro"; -const t = useTranslations(Astro.currentLocale); - const schema = { "@context": "https://schema.org", "@type": "WebPage", diff --git a/src/pages/en/contact.astro b/src/pages/en/contact.astro deleted file mode 100644 index 6ccb15c..0000000 --- a/src/pages/en/contact.astro +++ /dev/null @@ -1,5 +0,0 @@ ---- -import ContactPageLayout from "../../layouts/ContactPageLayout.astro"; ---- - -<ContactPageLayout /> diff --git a/src/pages/en/index.astro b/src/pages/en/index.astro deleted file mode 100644 index a7c9dbf..0000000 --- a/src/pages/en/index.astro +++ /dev/null @@ -1,5 +0,0 @@ ---- -import HomePageLayout from "../../layouts/HomePageLayout.astro"; ---- - -<HomePageLayout /> diff --git a/src/pages/en/portfolio.astro b/src/pages/en/portfolio.astro deleted file mode 100644 index 17c4637..0000000 --- a/src/pages/en/portfolio.astro +++ /dev/null @@ -1,5 +0,0 @@ ---- -import PortfolioPageLayout from "../../layouts/PortfolioPageLayout.astro"; ---- - -<PortfolioPageLayout /> diff --git a/src/pages/en/trajectory.astro b/src/pages/en/trajectory.astro deleted file mode 100644 index cb5b088..0000000 --- a/src/pages/en/trajectory.astro +++ /dev/null @@ -1,5 +0,0 @@ ---- -import TrajectoryPageLayout from "../../layouts/TrajectoryPageLayout.astro"; ---- - -<TrajectoryPageLayout /> diff --git a/src/pages/geoblocked.astro b/src/pages/geoblocked.astro new file mode 100644 index 0000000..a4f27d5 --- /dev/null +++ b/src/pages/geoblocked.astro @@ -0,0 +1,5 @@ +--- +import GeoblockedPageLayout from "../layouts/GeoblockedPageLayout.astro"; +--- + +<GeoblockedPageLayout /> diff --git a/src/partials/Footer.astro b/src/partials/Footer.astro index 82e3bb0..c27035d 100644 --- a/src/partials/Footer.astro +++ b/src/partials/Footer.astro @@ -1,7 +1,5 @@ --- -import { useTranslations } from "../i18n"; - -const t = useTranslations(Astro.currentLocale); +import t from "../i18n/es.json"; --- <footer> diff --git a/src/partials/Header.astro b/src/partials/Header.astro index 8af8ea1..e305492 100644 --- a/src/partials/Header.astro +++ b/src/partials/Header.astro @@ -1,22 +1,13 @@ --- -import { getRelativeLocaleUrl } from "astro:i18n"; -import { useTranslations } from "../i18n"; - -const t = useTranslations(Astro.currentLocale); +import t from "../i18n/es.json"; --- <header> - <a href={getRelativeLocaleUrl(Astro.currentLocale!, "")}>{t.header.home}</a> - <a href={getRelativeLocaleUrl(Astro.currentLocale!, "trajectory")} - >{t.header.trajectory}</a - > - <a href={getRelativeLocaleUrl(Astro.currentLocale!, "portfolio")} - >{t.header.portfolio}</a - > - <a href={getRelativeLocaleUrl("es", "blog")}>{t.header.blog}</a> - <a href={getRelativeLocaleUrl(Astro.currentLocale!, "contact")} - >{t.header.contact}</a - > + <a href="/">{t.header.home}</a> + <a href="/trajectory">{t.header.trajectory}</a> + <a href="/portfolio">{t.header.portfolio}</a> + <a href="/blog">{t.header.blog}</a> + <a href="/contact">{t.header.contact}</a> </header> <style lang="scss"> |
