feat(localization): implement localePath for project links across components

- Updated HytaleDemoGrid.vue, ProjectCard.vue, FeaturedProjectsSection.vue, about.vue, and project/[id].vue to utilize localePath for project links, enhancing localization support.
- This change ensures that project URLs are correctly localized, improving user experience across different languages.

This commit strengthens the site's multilingual capabilities by standardizing project link paths.
This commit is contained in:
2026-04-28 19:29:40 +02:00
parent 5ae226bbf2
commit 33bbb7a3b9
5 changed files with 21 additions and 7 deletions
+10
View File
@@ -2,6 +2,7 @@
import { hytaleDemos } from '~/data/hytaleDemos'
const { t } = useI18n()
const localePath = useLocalePath()
</script>
<template>
@@ -76,6 +77,15 @@ const { t } = useI18n()
</div>
<div class="flex flex-wrap gap-2 mt-2">
<UButton
:to="localePath(`/project/${demo.id}`)"
color="primary"
variant="soft"
size="sm"
trailing-icon="i-lucide-arrow-right"
>
{{ t('projects.buttons.viewProject') }}
</UButton>
<UButton
v-if="demo.website"
:to="demo.website"
+3 -2
View File
@@ -7,6 +7,7 @@ interface Props {
const props = defineProps<Props>()
const { t } = useI18n()
const localePath = useLocalePath()
const translatedCategory = computed(() => {
if (!props.project.category) return ''
@@ -22,7 +23,7 @@ const translatedCategory = computed(() => {
itemtype="https://schema.org/CreativeWork"
>
<!-- Image -->
<NuxtLink :to="`/project/${project.id}`" class="block relative overflow-hidden">
<NuxtLink :to="localePath(`/project/${project.id}`)" class="block relative overflow-hidden">
<NuxtImg
:src="project.image"
:alt="`${project.title} - ${project.description.slice(0, 60)}...`"
@@ -81,7 +82,7 @@ const translatedCategory = computed(() => {
<!-- Hidden SEO link -->
<NuxtLink
:to="`/project/${project.id}`"
:to="localePath(`/project/${project.id}`)"
class="absolute inset-0 z-10"
:aria-label="`${t('projects.buttons.viewProject')} - ${project.title}`"
itemprop="url"
@@ -1,6 +1,7 @@
<script setup lang="ts">
const { t } = useI18n()
const { featuredProjects } = useProjects()
const localePath = useLocalePath()
</script>
<template>
@@ -13,7 +14,7 @@ const { featuredProjects } = useProjects()
<h2 class="text-3xl sm:text-4xl lg:text-5xl font-bold mt-3 bg-gradient-to-r from-gray-900 via-gray-800 to-gray-600 dark:from-white dark:via-gray-200 dark:to-gray-500 bg-clip-text text-transparent">{{ t('home.featuredProjects.title') }}</h2>
<p class="text-lg text-gray-500 dark:text-gray-400 mt-4 max-w-2xl leading-relaxed">{{ t('home.featuredProjects.subtitle') }}</p>
</div>
<UButton to="/projects" variant="ghost" trailing-icon="i-lucide-arrow-right" class="shrink-0 self-start md:self-auto group">
<UButton :to="localePath('/projects')" variant="ghost" trailing-icon="i-lucide-arrow-right" class="shrink-0 self-start md:self-auto group">
{{ t('home.cta.viewProjects') }}
</UButton>
</div>
+3 -2
View File
@@ -2,6 +2,7 @@
import { techStack } from '~/data/techstack'
const { t } = useI18n()
const localePath = useLocalePath()
useSeoMeta({
title: () => t('seo.about.title'),
@@ -180,9 +181,9 @@ const approachCards = computed(() => [
:title="t('about.cta.title')"
:subtitle="t('about.cta.description')"
:primary-text="t('about.cta.button')"
primary-to="/contact"
:primary-to="localePath('/contact')"
:secondary-text="t('home.cta.viewProjects')"
secondary-to="/projects"
:secondary-to="localePath('/projects')"
/>
</div>
</template>
+3 -2
View File
@@ -1,6 +1,7 @@
<script setup lang="ts">
const route = useRoute()
const { t } = useI18n()
const localePath = useLocalePath()
const { findById, projects } = useProjects()
const project = findById(route.params.id as string)
@@ -52,7 +53,7 @@ useSeoMeta({
variant="solid"
color="neutral"
icon="i-lucide-arrow-left"
to="/projects"
:to="localePath('/projects')"
size="sm"
class="shadow-lg backdrop-blur-sm"
>
@@ -215,7 +216,7 @@ useSeoMeta({
<NuxtLink
v-for="related in relatedProjects"
:key="related.id"
:to="`/project/${related.id}`"
:to="localePath(`/project/${related.id}`)"
class="flex gap-3 p-3 rounded-xl border border-transparent hover:border-brand-500/20 hover:bg-brand-500/5 transition-all duration-200 group"
>
<NuxtImg